apollo icon indicating copy to clipboard operation
apollo copied to clipboard

`dataIdFromObject` is never called

Open ssyberg opened this issue 1 year ago • 1 comments

Environment

Describe the bug

dataIdFromObject is never called in inMemoryCacheOptions and hence it's impossible to set fallback cache ids

Expected behaviour

to be able to create fallback cache ids with dataIdFromObject

Reproduction

Add dataIdFromObject to inMemoryCacheOptions and add debugger or console logs and you'll see it never gets hit, you'll also notice if you use tools to view the client cache the cache ids are not altered by anything in this function

I've tried this with both useQuery and useAsyncQuery. I am able to override with individual typePolicies but this is extremely brittle since this is a system wide change we need to make.

Additional context

No response

Logs

No response

ssyberg avatar Nov 16 '23 16:11 ssyberg

Looks like there's been some progress on this in alpha 10, it is now being called, but it's still not quite working. I tried just calling return dataIdFromObject(object) which should effectively leave cache ids as their defaults and things break without any specific errors exposed

ssyberg avatar Dec 11 '23 16:12 ssyberg