non-global dataIdFromObject?
See original GitHub issueWhen I write an implementation for dataIdFromObject
, it seems like if I have two entities with the same ID that they’ll end up at the same place in the store. Is there a way to implement a non-global dataIdFromObject
function? Or alternatively have access to the path for the data so that that can be considered when assigning an ID?
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (3 by maintainers)
Top Results From Across the Web
Configuring the Apollo Client cache - Apollo GraphQL Docs
dataIdFromObject. Function. A function that takes a response object and returns a unique identifier to be used when normalizing the data in the...
Read more >Accessing Query Variables inside dataIdFromObject ... - GitHub
I want to access the query variables to set the key in local cache since my query doesn't have id and identical by...
Read more >Apollo Cache – Angular - GraphQL Code Generator
dataIdFromObject : A function that takes a data object and returns a unique identifier to be used when normalizing the data in the...
Read more >apollo-link-state and how do I access the local state / cache?
url}/graphql`, opts: { credentials: 'include' } }), addTypename: true, dataIdFromObject });. I am passing in an empty object for my resolvers as ...
Read more >Interacting with cached data - Apollo GraphQL - w3resource
const todo = client.readFragment({ id: ..., // `id` is any id that could be returned by `dataIdFromObject`. fragment: gql` fragment myTodo ...
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
dataIdFromObject
is specifically to tell apollo client that two objets with different paths are actually the same. If you don’t want that, you can just not assign it an id, in which case apollo client will use the path.@helfer That’s pretty unfortunate. It seems less than ideal to require adding
__typename
to every query to get entity mapping working. It seems like this situation would be a common one based on how most people store their data?