Misc get started tweaks and more robust useLazyQuery documentation - #12833
Conversation
|
✅ Docs preview readyThe preview is ready to be viewed. View the preview File Changes 26 new, 66 changed, 5 removedBuild ID: f53eeda74294a1d2c7ada243 URL: https://www.apollographql.com/docs/deploy-preview/f53eeda74294a1d2c7ada243 |
commit: |
size-limit report 📦
|
There was a problem hiding this comment.
Note: I've avoided using dataState in the examples until we have that completely flushed out.
83bb286 to
c47e0e2
Compare
phryneas
left a comment
There was a problem hiding this comment.
Some minor additions, looks great!
| @@ -21,15 +21,14 @@ Applications that use Apollo Client require two top-level dependencies: | |||
|
|
|||
There was a problem hiding this comment.
Above this line:
-Applications that use Apollo Client require two top-level dependencies:
+Applications that use Apollo Client require three top-level dependencies:There was a problem hiding this comment.
Good catch! I changed it to "the following" instead so we don't have to remember to update the count ever again 🤣
|
|
||
| #### Retaining query results | ||
|
|
||
| In-flight queries executed by `useLazyQuery` are aborted when the component unmounts, causing the promise to reject. In some cases, you might find this behavior undesirable and would prefer to let the query run to completion. |
There was a problem hiding this comment.
| In-flight queries executed by `useLazyQuery` are aborted when the component unmounts, causing the promise to reject. In some cases, you might find this behavior undesirable and would prefer to let the query run to completion. | |
| In-flight queries executed by `useLazyQuery` are aborted when the component unmounts or another query ist started via the execution function, causing the promise to reject. (This is a silent rejection, so unless you called `.then`, `.catch` or `await`ed the promise, you won't see it.) |
There was a problem hiding this comment.
Two independent edits in this - the addition in parantheses could also be a <Note pararaph? Not sure.
There was a problem hiding this comment.
Ya I think a note makes sense. I'll expand on this a bit more as well.
Co-authored-by: Lenz Weber-Tronic <lorenz.weber-tronic@apollographql.com>
Co-authored-by: Lenz Weber-Tronic <lorenz.weber-tronic@apollographql.com>
Co-authored-by: Lenz Weber-Tronic <lorenz.weber-tronic@apollographql.com>
|
|
||
| <Note> | ||
|
|
||
| Apollo Client ensures the rejected promise doesn't throw an unhandled rejection error when you don't add a rejection handler to the promise. This however means that aborted errors are silent and might go unnoticed. If you want to be notified when the request is aborted, provide a rejection handler for the promise. |
There was a problem hiding this comment.
This is not completely correct - calling promise.then(onlyAResolvedHandler) will also cause an error to be thrown, not only promise.then(resolvedHandler, rejectionHandler) or promise.catch(rejectionHandler)
Most of the work in this PR makes the documentation for
useLazyQuerymuch more robust. Previously the section included a paragraph and a single example for using it. I've instead framed the hook as a way to execute queries in response to user interaction. I've also added more subsections that describe the capabilities ofuseLazyQuerymuch more in depth.I also tweaks a couple things in the get started guide for accuracy.