Skip to content
Source
Sign inSign up
TanStack/query

feat(query-core)!: gc at latest removal time #12680

Openbenjavicente(GitHub profile, opens in a new tab)wants to merge 1 commit intoquery-v6 fromrefs/pull/12680/headopened View on GitHub

Showing 12 changed files with 54 additions and 19 deletions (loading 9).

x
0 of 12 viewed, 12 left
5 additions and 0 deletions.changeset/gc-removal-time.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+"@tanstack/query-core": major
+---
+​
+Garbage collect a query or mutation at the latest removal time any of its users has scheduled, instead of after the largest `gcTime` it has seen. Remove the `gcTime` property from `Query` and `Mutation`; read `options.gcTime` instead.
2 additions and 19 deletionspackages/query-core/src/__tests__/mutation.test-d.tsxModified
View file
@@ -180,7 +180,6 @@
| 'removeObserver'
| 'continue'
| 'execute'
- | 'gcTime'
| 'destroy'
>()
@@ -339,7 +338,7 @@
​
describe('removeObserver', () => {
- it('should take a single observer and return nothing', () => {
+ it('should take an observer and a gcTime and return nothing', () => {
const mutation = Mutation.build<
{ value: string },
CustomError,
@@ -352,7 +351,7 @@
​
expectTypeOf(mutation.removeObserver).returns.toEqualTypeOf<void>()