ApolloClient3: TypePolicy merge readField function always requires a foreignObjOrRef
See original GitHub issueIntended outcome:
Be able to use readField
in merge
functions just like when using it in a read
function
Actual outcome:
When trying to use it without foreignObjOrRef
parameter, the function will always throw
- Network error: Must provide an object or Reference when calling Policies#readField
How to reproduce the issue:
Just use the readField
function in a merge
TypePolicy field
Versions
^3.0.0-beta.43
Issue Analytics
- State:
- Created 3 years ago
- Reactions:2
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Customizing the behavior of cached fields - Apollo GraphQL
A merge function that specifies what happens when field's cached value is written; An array of key arguments that help the cache avoid...
Read more >Customizing the behavior of cached fields - Client (React)
A merge function that specifies what happens when field's cached value is written; An array of key arguments that help the cache avoid...
Read more >Type Policies in Apollo Client 3: An Introduction - YouTube
What are type policies in Apollo Client 3 and how can we leverage them in our applications? This video explores some of the...
Read more >Apollo GraphQL: use case for merge function in type policy?
If you have mutations that add/remove a single item and others that overwrite the entire set, then you need some merge magic to...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
What’s the blessed path for persisting fields in some storage scheme, then?
consider
@Banou26 You may want to look at this comment in the code though:
https://github.com/apollographql/apollo-client/blob/master/src/cache/inmemory/policies.ts#L549