Skip to content
Source
Sign inSign up
TanStack/query

fix(query-core): scope abort signal consumption to each fetch 🤖🤖🤖 #12717

Open0718lol(GitHub profile, opens in a new tab)wants to merge 1 commit intomain fromrefs/pull/12717/headopened View on GitHub

Showing 4 changed files with 83 additions and 1 deletion (loading 1).

x
0 of 4 viewed, 4 left
5 additions and 0 deletions.changeset/scope-query-abort-signal.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/query-core': patch
+---
+​
+Fix unexpected cancellation of replacement requests and hydrated pending queries by tracking abort signal consumption separately for each fetch.
46 additions and 1 deletionpackages/query-core/src/__tests__/hydration.test.tsxModified
View file
@@ -5,9 +5,14 @@
import { MutationCache } from '../mutationCache'
import { QueryCache } from '../queryCache'
import { QueryClient } from '../queryClient'
+import { QueryObserver } from '../queryObserver'
import { noop } from '../utils'
import { executeMutation, mockOnlineManagerIsOnline } from './utils'
-import type { MutationFunction, MutationFunctionContext } from '../index'
+import type {
+ MutationFunction,
+ MutationFunctionContext,
+ QueryFunction,
+} from '../index'
​
describe('dehydration and rehydration', () => {
beforeEach(() => {
@@ -1029,6 +1034,46 @@
queryClient.clear()
+ it('should cache a hydrated pending query after unsubscribing when a previous fetch consumed its signal', async () => {