Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deal with missing data #3

Open
lukel97 opened this issue Mar 2, 2022 · 0 comments
Open

Deal with missing data #3

lukel97 opened this issue Mar 2, 2022 · 0 comments
Assignees

Comments

@lukel97
Copy link
Contributor

lukel97 commented Mar 2, 2022

Imagine 2 queries like:

query a {
   foo {
       __typename id
       baz { qux }
   }
}
query b {
   foo {
       __typename id
       baz { qan }
   }
}

where baz is a list of objects without any ID.
Query A is executed and the cache is stored as:

   foo:1 => {
       baz => [{ qux => 42 }]
   }

And now query B is executed, updating the cache to:

   foo:1 => {
       baz => [{ qan => 42 }]
   }

So we go to update query A's response with the new data in the cache, but qux isn't present on baz!
This is called the missing data problem apparently, and there are problems with it in both apollo and relay:

facebook/relay#2237 (comment)
apollographql/apollo-client#6375

https://github.com/apollographql/apollo-client/blob/4e147b579bff210dbbc884d918edb1e69c2cfa9f/src/cache/inmemory/readFromStore.ts#L261-L277

Consistency and refetching

In this specific example however, it looks like apollo refetches the query. Should investigate as to how/why it does that

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

No branches or pull requests

1 participant