Skip to content

Fix the local state functionality in the dev tools#286

Merged
jcreighton merged 1 commit intoapollographql:masterfrom
micmro:fix-local-schema
Oct 9, 2020
Merged

Fix the local state functionality in the dev tools#286
jcreighton merged 1 commit intoapollographql:masterfrom
micmro:fix-local-schema

Conversation

@micmro
Copy link
Copy Markdown
Contributor

@micmro micmro commented Sep 9, 2020

Since #263 the client-only schemas are not passed from the backend to the dev-tools anymore, which caused the dev-tools to not show any local-only schema information.

This PR is adding this back in, but using an immutable array as the previous version would append another apolloClientSchema copy to schemas each time next was called.

Test setup:

import { ApolloClient, gql, InMemoryCache } from "@apollo/client";

const typeDefs = gql`
  extend type Query {
    testClientOnlyFiled: [String]
  }
`;

const cache = new InMemoryCache({
  typePolicies: {
    Query: {
      fields: {
        testClientOnlyFiled: {
          read() {
            return "TEST";
          },
        },
      },
    },
  },
});

export const apolloClient = new ApolloClient({
  uri: "https://graphqlzero.almansi.me/api",
  cache,
  typeDefs,
});

Before this change (expected testClientOnlyFiled to be in Query and Explorer panel):
Screenshot 2020-09-09 at 10 42 45 PM

After this change (testClientOnlyFiled is in Query and Explorer panel):
Screenshot 2020-09-09 at 10 40 42 PM

apollographql#263 had removed passing the client-only schema from to the dev-tools
@apollo-cla
Copy link
Copy Markdown

@micmro: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/

@micmro
Copy link
Copy Markdown
Contributor Author

micmro commented Sep 26, 2020

@jcreighton @hwillson @benjamn do you have any feedback for this fix? This should fix #239

@rebz
Copy link
Copy Markdown

rebz commented Oct 9, 2020

Is there an update on this?

@jcreighton
Copy link
Copy Markdown
Contributor

@micmro Thanks for this! I'll try to cut a new release soon.

@jcreighton jcreighton merged commit 31562a4 into apollographql:master Oct 9, 2020
@fbegue
Copy link
Copy Markdown

fbegue commented Oct 24, 2020

I have been unable to get your test case working with:

devtools version 2.3.1
"@apollo/client": "^3.2.5",
"@apollo/react-hooks": "^3.1.3",

Only difference being that I use the typical provider setup:

const withApolloProvider = (WrappedComponent, graphqlEndpoint) => { const apolloClient = new ApolloClient({ uri: "https://graphqlzero.almansi.me/api", cache, typeDefs, }) return (props) => ( <ApolloProvider client={apolloClient}> <WrappedComponent {...props} wrappedBy={"withApolloProvider"} /> </ApolloProvider> ) }

Any suggestions?

@micmro
Copy link
Copy Markdown
Contributor Author

micmro commented Oct 25, 2020

@fbegue this is probably because the changes from this PR have not been released yet.

Sorry to bug you again @jcreighton, but is there any plan to cut a new release soon?

@jcreighton
Copy link
Copy Markdown
Contributor

@micmro Yes, working on that soon.

@seunghwansohn
Copy link
Copy Markdown

omg.. so when???

@jcreighton
Copy link
Copy Markdown
Contributor

Version 2.3.2 released on Firefox and Chrome!

@seunghwansohn
Copy link
Copy Markdown

seunghwansohn commented Oct 30, 2020

Version 2.3.2 released on Firefox and Chrome!

All the schemas on the Docs were disappeared after this update.. including schemas from apollo server..
There is no schema on the Docs and Explorer.
What did you do on this update?
I think apollo has a lot of problems in developing tools on browsers..

This is a snapshot from Chrome
chrome_OugKIiJqY8

This is a snapshot from Firefox
firefox_43f9k72qXz

@jcreighton
Copy link
Copy Markdown
Contributor

@seunghwansohn Please be respectful in your responses. This project is maintained with a small team spread across projects . We are also in the middle of a complete rewrite of these tools to address issues in reliability and to make it easier to develop future improvements. You are more than welcome to open pull requests, if you'd like to contribute to the project.

@seunghwansohn
Copy link
Copy Markdown

@seunghwansohn Please be respectful in your responses. This project is maintained with a small team spread across projects . We are also in the middle of a complete rewrite of these tools to address issues in reliability and to make it easier to develop future improvements. You are more than welcome to open pull requests, if you'd like to contribute to the project.

I see.. I think you rather develop a middleware loading on the apollo-client side. Through this, the developer can control the possibility of using dev tools on browsers. This dev tool is not reliable and risky now. You can refer to the Redux dev tools. Apollo is great, but not comparable to Redux only in terms of dev tool..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants