Skip to content
Source
Sign inSign up
TanStack/query

refactor(react-query): simplify the Suspense promise cache #12682

MergedTkDodomerged 1 commit intoquery-v6 fromrefs/pull/12682/headmerged by TkDodo View on GitHub

Showing 3 changed files with 25 additions and 35 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/wild-rocks-smile.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+"@tanstack/react-query": patch
+---
+​
+Reduce the full React bundle size by simplifying the Suspense promise cache.
5 additions and 3 deletionspackages/react-query/src/__tests__/suspense.test.tsxModified
View file
@@ -82,7 +82,7 @@
await firstPromise
})
​
- it('should keep the suspense promise stable after it settles', async () => {
+ it('should create a new suspense promise when fetching again after it settles', async () => {
const key = createKey()
const options = queryClient.defaultQueryOptions({
queryKey: key,
@@ -111,10 +111,12 @@
observer,
errorResetBoundary,
observer.getCurrentQuery(),
- false,
​
- expect(secondPromise).toBe(firstPromise)
+ expect(secondPromise).not.toBe(firstPromise)
+​
+ await vi.advanceTimersByTimeAsync(10)
+ await secondPromise