Skip to content
Source
Sign inSign up
TanStack/query

fix(solid-query): prevent suspense trigger with pre-cached data #10053

Closedshinseongsu(GitHub profile, opens in a new tab)wants to merge 2 commits intomain fromrefs/pull/10053/headopened View on GitHub

Showing 3 changed files with 88 additions and 3 deletions.

x
0 of 3 viewed, 3 left
5 additions and 0 deletions.changeset/solid-query-suspense-cached-data.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/solid-query': patch
+---
+​
+Prevent Suspense from being triggered when the query already has cached data.
72 additions and 0 deletionspackages/solid-query/src/__tests__/suspense.test.tsxModified
View file
@@ -951,4 +951,76 @@
expect(renders).toBe(2)
expect(rendered.queryByText('rendered')).toBeInTheDocument()
+​
+ it('should not trigger suspense when setQueryData is called with pre-cached data and refetchOnMount: false', async () => {
+ const key = queryKey()
+ let suspenseCount = 0
+​
+ const localQueryClient = new QueryClient({
+ defaultOptions: {
+ queries: {
+ refetchOnMount: false,
+ },
+ },
+ })
+​