apollographql / apollo-ios

📱  A strongly-typed, caching GraphQL client for iOS, written in Swift.
https://www.apollographql.com/docs/ios/
MIT License
3.89k stars 728 forks source link

SchemaConfiguration.cacheKeyInfo(for:object:) never called? #3341

Closed jotai-coder closed 8 months ago

jotai-coder commented 9 months ago

Question

(version 1.7.0)

I'm trying to define custom cache keys for some of our custom scalars as described in the docs.

However, cacheKeyInfo(for:object:) on SchemaConfiguration is never called during execution of our queries, so we're getting the default cache key implementation.

The only path that I see for calling this is in: GraphQLExecutor.executeChildSelections(forObjectTypeFields:withRootType:onChildObject:accumulator:) Ultimately implemented in CacheKeyComputingExecutionSource extension. I'm sure I've missed something, but can't sort out what. Thanks.

calvincestari commented 9 months ago

@jotai-coder where are you defining the custom cache key function? It must be in the SchemaConfiguration.swift file to be called correctly. If that is how you've set it up then please share a sample project demonstrating the issue that we can debug.

jotai-coder commented 8 months ago

@jotai-coder where are you defining the custom cache key function? It must be in the SchemaConfiguration.swift file to be called correctly. If that is how you've set it up then please share a sample project demonstrating the issue that we can debug.

Do you have a template project I could use as a starting point?

calvincestari commented 8 months ago

You just need a simple project with a schema you can share. As long as it demonstrates the problem it doesn't need to be anything complicated.

AnthonyMDev commented 8 months ago

I'm closing this issue due to inactivity. If this is still unresolved, feel free to provide more information and we can re-open this, or create a new issue.

github-actions[bot] commented 8 months ago

Do you have any feedback for the maintainers? Please tell us by taking a one-minute survey. Your responses will help us understand Apollo iOS usage and allow us to serve you better.