Skip to content

Graphcache: Resolving partial data from the same entity #1747

Answered by JoviDeCroock
cvpcasada asked this question in Q&A
Discussion options

You must be logged in to vote

Hey,

Yes the cache will merge these two results so imagine the following scenario:

{
  id:1
  __typename: "File",
  comments: {
    edges: [{ node: { id: 1, __typename: 'Comment' } }]
  }
}

Then the cache will save the records File:1.id=1, ... and save that File:1 links to the comments it has received, this is how normalized caching will handle this.

Now when comments is marked as optional and you've done the first query you'll get a partial result (recognizable by stale: true). This means that we'll give you the data from the first query while we resolve the additional fields (comments) from the second.

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@JoviDeCroock
Comment options

@thenbe
Comment options

@JoviDeCroock
Comment options

@thenbe
Comment options

@JoviDeCroock
Comment options

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