Skip to content

Commit

Permalink
update hook to expose data in UNSTABLE_extraVariables
Browse files Browse the repository at this point in the history
Reviewed By: tyao1

Differential Revision: D65864684

fbshipit-source-id: fb21173e8b27c21fff01a446eea74494ded8f4a9
  • Loading branch information
lynnshaoyu authored and facebook-github-bot committed Nov 13, 2024
1 parent 8a501be commit 53cef9d
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,11 @@ type LoadMoreOptions<TVariables> = {
onComplete?: (Error | null) => void,
};

export type GetExtraVariablesFn<TEdgeData, TVariables> = ({
export type GetExtraVariablesFn<TEdgeData, TData, TVariables, TKey> = ({
hasNext: boolean,
data: [+key: TKey] extends [+key: {+$fragmentSpreads: mixed, ...}]
? TData
: ?TData,
getServerEdges: () => TEdgeData,
}) => Partial<TVariables>;

Expand All @@ -93,7 +96,7 @@ hook usePrefetchableForwardPaginationFragment_EXPERIMENTAL<
prefetchingLoadMoreOptions?: {
UNSTABLE_extraVariables?:
| Partial<TVariables>
| GetExtraVariablesFn<TEdgeData, TVariables>,
| GetExtraVariablesFn<TEdgeData, TData, TVariables, TKey>,
onComplete?: (Error | null) => void,
},
minimalFetchSize: number = 1,
Expand Down Expand Up @@ -290,6 +293,8 @@ hook usePrefetchableForwardPaginationFragment_EXPERIMENTAL<
? // $FlowFixMe[incompatible-call]
prefetchingUNSTABLE_extraVariables({
hasNext,
// $FlowFixMe[incompatible-call]
data: fragmentData,
getServerEdges: () => {
const selector = getSelector(edgesFragment, edgeKeys);
const result = [];
Expand Down

0 comments on commit 53cef9d

Please sign in to comment.