-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Document new React APIs in 3.9 - Part 1 of 2 #11512
Conversation
|
size-limit report 📦
|
docs/source/data/suspense.mdx
Outdated
@@ -433,6 +433,58 @@ When the network request for `GET_DOG_QUERY` completes, the `Dog` component unsu | |||
|
|||
The `useBackgroundQuery` hook used in a parent component is responsible for kicking off fetches, but doesn't deal with reading or rendering data. This is delegated to the `useReadQuery` hook used in a child component. This separation of concerns provides a nice performance benefit because cache updates are observed by `useReadQuery` and re-render only the child component. You may find this as a useful tool to optimize your component structure to avoid unnecessarily re-rendering parent components when cache data changes. | |||
|
|||
<MinVersion version="3.9.0"> | |||
|
|||
### Querying in response to user interaction |
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.
Another point of feedback: Does this section include enough information?
Some other things we could talk about if we want to provide additional info:
- The hook does not take a
variables
option and instead variables are passed to theloadQuery
function. - The hook exports a
reset
function that when called, sets thequeryRef
back tonull
This section is also provided right before pagination/refetching, which uses useBackgroundQuery
as the example. Should this be moved afterward? Feedback welcome!
useLoadableQuery
- Part 1 of 2474b6b4
to
9533f3b
Compare
9533f3b
to
fe9674a
Compare
329c4b5
to
fefd6a4
Compare
✅ Deploy Preview for apollo-client-docs ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
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.
Excited to get these merged 🔥 Added some comments where I'm thinking aloud but overall everything is easy to follow and the examples are a natural extension of the 3.8 docs 🎉 🎉
Let's update our last example back to `useBackgroundQuery` and get the `refetch` function from the `useQueryRefHandlers` hook in the `Dog` component. | ||
|
||
```tsx {15,16,18-22,30} | ||
function App() { |
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.
I'm going to throw the rest of these in the codesandbox too 👍
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.
Ah yes thank you! Was on my todo, but hadn't got to it yet!
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Co-authored-by: Alessia Bellisario <[email protected]>
Closes #11491
Closes #11493
Closes #11494
Adds new sections to our suspense docs for
useLoadableQuery
,createQueryPreloader
, anduseQueryRefHandlers
.NOTE: This only addresses the "guide" part of the documentation. A followup PR to ensure the API documentation for the hook is available (options, return values, etc.). This may require edits to code and will fall in line with the changes in #11381