apollo-client-devtools: Chrome Apollo Client Extension does not see schema for local state.
Hi there. Basically i’ve started doing some pet project and decided not to create a server itself but use local state management for now.
I’m doing the following thing:
const cache = new InMemoryCache();
const client = new ApolloClient({
cache,
resolvers,
typeDefs
});
cache.writeData({
data: {
appState: {
isCollapsed: true,
__typename: 'AppState'
}
},
});
const applicationContainer = document.getElementById('application-root');
const application = (
<ApolloProvider client={client}>
<Pages></Pages>>
</ApolloProvider>
);
ReactDOM.render(application, applicationContainer);
Here is schema:
export const typeDefs = gql`
type Query {
appState: AppState
}
type AppState {
isCollapsed: Boolean
}
`;
And here is resolvers
export const GET_APP_STATE = gql`
query GetAppState {
appState @client
}
`;
export const resolvers = {
Query:{
appState: ( _, { cache }) => {
const { appState } = cache.readQuery({ query: GET_APP_STATE });
return appState;
},
}
};
When i run Apollo Dev tools in chrome i expect to see schema but it’s empty. Query works as expected.
About this issue
- Original URL
- State: open
- Created 5 years ago
- Reactions: 31
- Comments: 29 (2 by maintainers)
Yes, really enjoying the update, thanks @hwillson and team! But note, it does not fix the subject of this issue - showing local only schemas. My above workaround will get you there in the meantime.
@reifnotreef yes, we just launched 3.0 which includes the new UI you’ve noticed, but is also a full re-write behind the scenes to put a better foundation in place for future growth. Glad to hear it’s working - thanks!
+1
Just had this start happening to me yesterday.
Also still seeing this
I’m using 3.0.5 in chromium and it’s broken for me. I’m only following the tutorial for local state
This is my local schema
If I use the @client directive, it tells me that’s not right
If I don’t have the directive and select “Load from cache” I still get the data though
So it seems like an issue with devTools, not with apollo client. The cache tab also shows that the cache is empty, even though it’s not
For sure, thanks @vigie - we’ll dig into this shortly.
Any updates on this issue from Apollo? I’m running the latest Apollo Client v3.1.4 and no typeDefs defined on the client side are shown in Dev Tools Schema tab (DevTools v2.3.1). I’ve tried with and without the extend keyword in front of type. Server side typeDefs are shown fine. Even when completely disconnecting the server in the config (for testing), no client typeDefs (schema) are shown.
Same here. I am very enthusiastically contemplating using Apollo Client for all data (remote + local) but having the introspection break once I add a local schema is making me seriously reconsider this approach, as it makes dev (especially across a team) more labor intensive. Are you guys contemplating a fix for this?
Does not work for me either. Any comments on this from the Apollo team?