@tanstack/query-core 4.22.4 → 4.24.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/lib/query.esm.js +1 -0
- package/build/lib/query.esm.js.map +1 -1
- package/build/lib/query.js +1 -0
- package/build/lib/query.js.map +1 -1
- package/build/lib/query.mjs +1 -0
- package/build/lib/query.mjs.map +1 -1
- package/build/umd/index.development.js +1 -0
- package/build/umd/index.development.js.map +1 -1
- package/build/umd/index.production.js +1 -1
- package/build/umd/index.production.js.map +1 -1
- package/package.json +1 -2
- package/src/query.ts +1 -0
- package/src/tests/query.test.tsx +24 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tanstack/query-core",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.24.2",
|
|
4
4
|
"description": "The framework agnostic core that powers TanStack Query",
|
|
5
5
|
"author": "tannerlinsley",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,7 +33,6 @@
|
|
|
33
33
|
"test:types": "tsc",
|
|
34
34
|
"test:lib": "jest --config ./jest.config.ts",
|
|
35
35
|
"test:lib:dev": "pnpm run test:lib --watch",
|
|
36
|
-
"test:lib:publish": "pnpm run test:lib --collectCoverage false",
|
|
37
36
|
"build:types": "tsc --build"
|
|
38
37
|
}
|
|
39
38
|
}
|
package/src/query.ts
CHANGED
package/src/tests/query.test.tsx
CHANGED
|
@@ -883,4 +883,28 @@ describe('query', () => {
|
|
|
883
883
|
|
|
884
884
|
expect(initialDataUpdatedAtSpy).toHaveBeenCalled()
|
|
885
885
|
})
|
|
886
|
+
|
|
887
|
+
test('queries should be garbage collected even if they never fetched', async () => {
|
|
888
|
+
const key = queryKey()
|
|
889
|
+
|
|
890
|
+
queryClient.setQueryDefaults(key, { cacheTime: 10 })
|
|
891
|
+
|
|
892
|
+
const fn = jest.fn()
|
|
893
|
+
|
|
894
|
+
const unsubscribe = queryClient.getQueryCache().subscribe(fn)
|
|
895
|
+
|
|
896
|
+
queryClient.setQueryData(key, 'data')
|
|
897
|
+
|
|
898
|
+
await waitFor(() =>
|
|
899
|
+
expect(fn).toHaveBeenCalledWith(
|
|
900
|
+
expect.objectContaining({
|
|
901
|
+
type: 'removed',
|
|
902
|
+
}),
|
|
903
|
+
),
|
|
904
|
+
)
|
|
905
|
+
|
|
906
|
+
expect(queryClient.getQueryCache().findAll()).toHaveLength(0)
|
|
907
|
+
|
|
908
|
+
unsubscribe()
|
|
909
|
+
})
|
|
886
910
|
})
|