-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document new React APIs in code - Part 2 of 2 (#11523)
- Loading branch information
1 parent
2a67ffc
commit 2964a13
Showing
13 changed files
with
206 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import React from "react"; | ||
import { useMDXComponents } from "@mdx-js/react"; | ||
import { ManualTuple } from "../ApiDoc"; | ||
|
||
const HANDLERS = `{ | ||
fetchMore: FetchMoreFunction<TData, TVariables>; | ||
refetch: RefetchFunction<TData, TVariables>; | ||
reset: ResetFunction; | ||
}`; | ||
|
||
const RETURN_VALUE = `[ | ||
loadQuery: LoadQueryFunction<TVariables>, | ||
queryRef: QueryReference<TData, TVariables> | null, | ||
{ | ||
fetchMore: FetchMoreFunction<TData, TVariables>; | ||
refetch: RefetchFunction<TData, TVariables>; | ||
reset: ResetFunction; | ||
} | ||
]`; | ||
|
||
export function UseLoadableQueryResult() { | ||
const MDX = useMDXComponents(); | ||
|
||
return ( | ||
<div> | ||
<MDX.pre> | ||
<code className="language-ts">{RETURN_VALUE}</code> | ||
</MDX.pre> | ||
A tuple of three values: | ||
<ManualTuple | ||
idPrefix="useloadablequery-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> | null", | ||
description: | ||
"The `queryRef` used by `useReadQuery` to read the query result.", | ||
canonicalReference: "@apollo/client!QueryReference:interface", | ||
}, | ||
{ | ||
name: "handlers", | ||
description: | ||
"Additional handlers used for the query, such as `refetch`.", | ||
type: HANDLERS, | ||
}, | ||
]} | ||
/> | ||
</div> | ||
); | ||
} | ||
|
||
UseLoadableQueryResult.propTypes = {}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
--- | ||
title: Preloading | ||
description: Apollo Client preloading API reference | ||
minVersion: 3.9.0 | ||
api_doc: | ||
- "@apollo/client!createQueryPreloader:function(1)" | ||
--- | ||
|
||
import { FunctionDetails } from '../../../shared/ApiDoc'; | ||
|
||
<FunctionDetails canonicalReference="@apollo/client!createQueryPreloader:function(1)" headingLevel={2} /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.