-
Notifications
You must be signed in to change notification settings - Fork 701
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Confused about cache behavior #3383
Comments
Hi @guendev, it sounds like you haven't configured a cache key that Apollo iOS can use to normalize the object from your query and mutation. The web client has a more advanced cache and may be doing some of that automatically for you whereas Apollo iOS requires you to be explicit about identifying similar objects. I suggest reading the Normalizing responses section of the documentation which explains how responses are normalized without a custom cache key. Then move on to reading the Normalizing objects by cache key section which will guide you how to return a custom cache key for your object. Once you've got the custom cache key configured correctly you should get the behaviour you're looking for. I'm going to close this issue as there is no action for us to take here but I'm happy to continue the conversation with you here if you can't figure out the cache key. |
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. |
Question
Why doesn't the object update automatically when calling mutation?
My workflow: query setting -> mutation updateSetting. After that, if I query settings, It will return an updated object from cache (updated by updateSetting) if they have the same cache-id. It always works on javascript.
But when I did the same with
apollo-ios
. Cache doest update, it always returns the value from the first time.Btw, are there any way to print all existing object?
My swift code
My Operations
The text was updated successfully, but these errors were encountered: