nuxt-modules / apollo

Nuxt.js module to use Vue-Apollo. The Apollo integration for GraphQL.
https://apollo.nuxtjs.org
MIT License
929 stars 194 forks source link

`dataIdFromObject` is never called #569

Open ssyberg opened 7 months ago

ssyberg commented 7 months ago

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 commented 6 months ago

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