Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
KATT committed Dec 20, 2024
1 parent 5a1358e commit 30e819b
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions packages/react-query/src/useBaseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,11 +105,20 @@ export function useBaseQuery<
}, [observer, isRestoring])

React.useEffect(() => {
if (defaultedOptions.experimental_prefetchInRender) {
return
}
// Do not notify on updates because of changes in the options because
// these changes should already be reflected in the optimistic result.
observer.setOptions(defaultedOptions, { listeners: false })
}, [defaultedOptions, observer])

if (defaultedOptions.experimental_prefetchInRender) {
// Do not notify on updates because of changes in the options because
// these changes should already be reflected in the optimistic result.
observer.setOptions(defaultedOptions, { listeners: false })
}

// Handle suspense
if (shouldSuspend(defaultedOptions, result)) {
throw fetchOptimistic(defaultedOptions, observer, errorResetBoundary)
Expand Down

0 comments on commit 30e819b

Please sign in to comment.