Skip to content
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 code - Part 2 of 2 #11523

Merged
merged 28 commits into from
Jan 26, 2024
Merged
Changes from 1 commit
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
4b65afd
Mark symbols in QueryReference as internal
jerelmiller Jan 25, 2024
8f22e23
Add documentation on toPromise for QueryReference
jerelmiller Jan 25, 2024
b479711
Add inline code tag in createQueryPreloader description
jerelmiller Jan 25, 2024
2be5751
Add since tag to createQueryPreloader
jerelmiller Jan 25, 2024
00e075c
Add docblock for useLoadableQuery
jerelmiller Jan 25, 2024
7efaa70
Add useLoadableQuery to hooks page
jerelmiller Jan 25, 2024
44c7514
Add `@since` tag to useQueryRefHandlers
jerelmiller Jan 25, 2024
8623b09
Add useQueryRefHandlers to hooks documentation
jerelmiller Jan 25, 2024
40e10dc
Add link to documentation on createQueryPreloader
jerelmiller Jan 25, 2024
811c1dd
Rerun extract api report
jerelmiller Jan 25, 2024
fd229f6
Add additional info for toPromise
jerelmiller Jan 25, 2024
1d15fd3
Move doc for useLoadableQuery to first overload
jerelmiller Jan 26, 2024
7414629
Create a type for the handlers returned from useLoadableQuery
jerelmiller Jan 26, 2024
e9f56d6
Add doc comments to useLoadableQuery handlers
jerelmiller Jan 26, 2024
3e59cbe
Add more detailed code for useLoadableQuery
jerelmiller Jan 26, 2024
d6fcb1b
List createQueryPreloader as alpha
jerelmiller Jan 26, 2024
3199bb7
Clean up Prettier, Size-limit, and Api-Extractor
jerelmiller Jan 26, 2024
a80245e
Use `@alpha` designation for toPromise on QueryReference
jerelmiller Jan 26, 2024
44cc612
Clean up Prettier, Size-limit, and Api-Extractor
jerelmiller Jan 26, 2024
b88f14e
Fix id prefix
jerelmiller Jan 26, 2024
841f88d
Fix syntax error in list
jerelmiller Jan 26, 2024
3c572b1
Add new preloading doc for createQueryPreloader
jerelmiller Jan 26, 2024
b0516e2
Revert change to add handlers type
jerelmiller Jan 26, 2024
4760636
Allow overrides to be formatted
jerelmiller Jan 26, 2024
9b14c23
Move result override for useLoadableQuery to own component
jerelmiller Jan 26, 2024
0cef515
Move description for useLoadableQuery to last overload
jerelmiller Jan 26, 2024
b6a7040
Extract API
jerelmiller Jan 26, 2024
66b958e
Ensure | null is added to queryRef in return type
jerelmiller Jan 26, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add more detailed code for useLoadableQuery
  • Loading branch information
jerelmiller committed Jan 26, 2024
commit 3e59cbe91d3bbf3b8830933a96c4fef9abb5985f
37 changes: 34 additions & 3 deletions docs/source/api/react/hooks.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -407,6 +407,40 @@ function useReadQuery<TData>(

<UseReadQueryResult />

<FunctionDetails canonicalReference="@apollo/client!useLoadableQuery:function(1)" headingLevel={2}
result={<div>
<pre><code class="language-ts">
[loadQuery: LoadQueryFunction&lt;TVariables&gt;, queryRef: QueryReference&lt;TData, TVariables&gt;, handlers: UseLoadableQueryHandlers&lt;TData, TVariables&gt;]
</code></pre>

A tuple of three values:

<ManualTuple
idPrefix="usepreloadedquery-result"
elements={[
{
name: "loadQuery",
type: "LoadQueryFunction<TVariables>",
description: "A function used to imperatively load a query. Calling this function will create or update the `queryRef` returned by `useLoadableQuery`, which should be passed to `useReadQuery`."
},
{
name: "queryRef",
type: "QueryReference<TData, TVariables>",
description: "The `queryRef` used by `useReadQuery` to read the query result."
canonicalReference: "@apollo/client!QueryReference:interface"
},
{
name: "handlers",
type: "UseLoadableQueryHandlers<TData, TVariables>",
description: "",
canonicalReference: "@apollo/client!UseLoadableQueryHandlers:interface"
}
]}
/>
</div>}
/>
<FunctionDetails canonicalReference="@apollo/client!useQueryRefHandlers:function(1)" headingLevel={2} />

<MinVersion version="3.8.0">

## `skipToken`
Expand Down Expand Up @@ -479,6 +513,3 @@ const { data } = useSuspenseQuery(
In this case, it becomes apparent for TypeScript that there is a direct connection between skipping and the `variables` option - and it will work without unsafe workarounds.

</blockquote>

<FunctionDetails canonicalReference="@apollo/client!useLoadableQuery:function(1)" headingLevel={2} />
<FunctionDetails canonicalReference="@apollo/client!useQueryRefHandlers:function(1)" headingLevel={2} />