Skip to content

Commit

Permalink
ci: apply automated fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
autofix-ci[bot] authored Dec 13, 2024
1 parent 201169a commit 3b3d1e9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
11 changes: 9 additions & 2 deletions packages/react-query/src/__tests__/useQuery.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4799,8 +4799,15 @@ describe('useQuery', () => {

expect(count).toBe(2)


expect(arrayPick(states, ['data', 'isStale', 'isFetching', 'isPending', 'isSuccess'])).toMatchInlineSnapshot(`
expect(
arrayPick(states, [
'data',
'isStale',
'isFetching',
'isPending',
'isSuccess',
]),
).toMatchInlineSnapshot(`
[
{
"data": undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -903,4 +903,4 @@ describe('useSuspenseQuery', () => {
)
consoleErrorSpy.mockRestore()
})
})
})
6 changes: 2 additions & 4 deletions packages/react-query/src/useBaseQuery.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,8 +84,7 @@ export function useBaseQuery<

const [_, setForceUpdate] = React.useState(0)

const result =
observer.getOptimisticResult(defaultedOptions)
const result = observer.getOptimisticResult(defaultedOptions)

// console.log('result', result)
React.useEffect(() => {
Expand All @@ -96,7 +95,7 @@ export function useBaseQuery<

const unsubscribe = observer.subscribe(
notifyManager.batchCalls(() => {
setForceUpdate(n => n + 1)
setForceUpdate((n) => n + 1)
}),
)

Expand All @@ -107,7 +106,6 @@ export function useBaseQuery<
return unsubscribe
}, [observer, isRestoring])


React.useEffect(() => {
// Do not notify on updates because of changes in the options because
// these changes should already be reflected in the optimistic result.
Expand Down

0 comments on commit 3b3d1e9

Please sign in to comment.