Skip to content

Deal with missing data #3

Open
Open
@lukel97

Description

@lukel97

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

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions