Skip to content

Commit

Permalink
Add comment justifying the refs
Browse files Browse the repository at this point in the history
  • Loading branch information
jerelmiller committed Mar 31, 2023
1 parent a2c34e1 commit 18be640
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/react/hooks/useLazyQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export function useLazyQuery<TData = any, TVariables extends OperationVariables
const merged = execOptionsRef.current ? mergeOptions(options, execOptionsRef.current) : options;
const document = merged?.query ?? query;

// Use refs to track options and the used query to ensure the `execute`
// function remains referentially stable between renders.
optionsRef.current = merged;
queryRef.current = document;

Expand Down

0 comments on commit 18be640

Please sign in to comment.