-
Notifications
You must be signed in to change notification settings - Fork 2.7k
documentation updates for LocalState
#12781
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
Conversation
|
commit: |
size-limit report 📦
|
✅ Docs preview has no changesThe preview was not built because there were no changes. Build ID: 39a65431826bb6be8b2f223d |
!docs set-base-branch main |
1021a5e
to
8aaea4b
Compare
8e453f1
to
f1e7ef0
Compare
🛠️ Docs preview building...The preview is currently being built. Build ID: 87376bef33addd71f2ba7310 |
90d5b31
to
cd8c776
Compare
f1e7ef0
to
9cd56a9
Compare
9cd56a9
to
3e8cdda
Compare
🛠️ Docs preview building...The preview is currently being built. Build ID: 374bef2b3511200ef447c9b1 |
🛠️ Docs preview building...The preview is currently being built. Build ID: 40f0c63147af1965a675d6ac |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had a few suggestions, but looks good overall.
|
||
After running the code generator, you can use the generated `Resolvers` type with your `LocalState` instance: | ||
|
||
```ts |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code block could use another look for spacing.
### Code splitting | ||
Depending on the complexity and size of your local resolvers, you might not always want to define them up front, when you create your initial `ApolloClient` instance. If you have local resolvers that are only needed in a specific part of your application, you can leverage Apollo Client's [`addResolvers` and `setResolvers`](#methods) functions to adjust your resolver map at any point. This can be really useful when leveraging techniques like route based code-splitting, using something like [`react-loadable`](https://github.com/jamiebuilds/react-loadable). | ||
Depending on the complexity and size of your local resolvers, you might not always want to define them up front, when you create your initial `ApolloClient` instance. If you have local resolvers that are only needed in a specific part of your application, you can dynamically call `client.localState.addResolvers` to dynamically add new resolvers. This can be really useful when leveraging techniques like route based code-splitting. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does it make sense to use client.localState.addResolvers
or localState.addResolvers
? In one example, localState
is pulled out to a separate variable. I'm fine with either, but figured I'd pose the question.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't show it as a separate variable everywhere, and especially when you create an empty local state and add resolvers dynamically, you might do it inline. So I went with the "safer"
option here.
3e8cdda
to
0efa2ae
Compare
No description provided.