Skip to content

Cache Exchange with React #3638

Answered by kitten
alexnsorensen asked this question in Q&A
Discussion options

You must be logged in to vote

The resolvers is indeed the first step to start with. In the above example however please do note that classUnits is not defined correctly in all likelihood. You've written a resolver that returns the shape of a single entity for what's likely supposed to be a list, which will probably just fail.

The other resolver: classUnit: (_, args) => ({ __typename: 'ClassUnit', id: args.id }) looks just fine.

even though the query is still fetching because the list has already loaded the data?

The important thing to note here is that the two queries' selections won't match. And that's quite a common problem.
There's an important two important concepts to understand here first though, nullability a…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@kitten
Comment options

Answer selected by alexnsorensen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants