-
Notifications
You must be signed in to change notification settings - Fork 57
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
Add documentation about using GraphQLQueryWatcher with mutations #543
Conversation
@damian0815: Thank you for submitting a pull request! Before we can merge it, you'll need to sign the Apollo Contributor License Agreement here: https://contribute.apollographql.com/ |
👷 Deploy request for apollo-ios-docc pending review.Visit the deploys page to approve it
|
👷 Deploy request for eclectic-pie-88a2ba pending review.Visit the deploys page to approve it
|
🚫 Docs Preview DeniedYou must have approval from an Apollo team member to request a docs preview. If you are a team member, please comment File Changes 0 new, 1 changed, 0 removed
|
Going to merge this despite the Docs Preview check failing; I believe that is because it's on a fork. Once merged I'll double-check the published change. |
7e1c45b7 Add documentation about using GraphQLQueryWatcher with mutations (#543) git-subtree-dir: apollo-ios git-subtree-split: 7e1c45b74dfd75f1667a4312f73d547667dd61a0
…eryWatcher with mutations git-subtree-dir: apollo-ios git-subtree-mainline: 259e859 git-subtree-split: 7e1c45b74dfd75f1667a4312f73d547667dd61a0
oh @calvincestari I see you merged it already. I'm not sure this is sufficient - the documentation about "normalized cache" in the link you've added is ambiguous about whether Apollo iOS already implements cache normalization, or whether there are explicit steps that a user needs to do in order to complete that implementation. Indeed my reading of this document (that led to my problem with the cache keys being disjoint) was that Apollo iOS normalizes cache keys for me OOTB, so there's nothing further for me to do - which is why I was stumped when it didn't work the way I was expecting. On closer inspection there's a clause "if properly configured" in the introduction, but without a link to |
I see your point... Apollo iOS does implement cache normalization by default. The difference is that the default cache normalization happens at the operation root vs. the object until cache key normalization is implemented.
I think it would be sufficient to do this: diff --git forkSrcPrefix/docs/source/fetching/queries.mdx forkDstPrefix/docs/source/fetching/queries.mdx
index 2d6324dc884545063d10fe8baea47811e2115458..0c3ed0fbc1eea9b1a4246d5096aebcf6cbefc9a4 100644
--- forkSrcPrefix/docs/source/fetching/queries.mdx
+++ forkDstPrefix/docs/source/fetching/queries.mdx
@@ -23,7 +23,7 @@ let watcher = apollo.watch(query: HeroNameQuery()) { result in
}
-If your query shares response objects with other operations you will need to implement a [normalized cache](../caching/introduction) so that object data received in those other operations is written to the local cache and used to update your query watcher by invoking the result handler.
+If your query shares response objects with other operations you will need to implement [cache key normalization](../caching/introduction#normalizing-objects-by-cache-key) so that object data received in those other operations is normalized in the local cache and used to update your query watcher by invoking the result handler.
When you call `ApolloClient.watch(query:)` a [`GraphQLQueryWatcher`](https://www.apollographql.com/docs/ios/docc/documentation/apollo/graphqlquerywatcher) is returned. Changes to the query's data will be watched until `cancel()` is called on the watcher. Is that clearer? |
Ref apollographql/apollo-ios#3472