Skip to content
Source
Sign inSign up
TanStack/query

refactor(angular-query): require Angular v19+ and rely on component effect schedule timing #9893

Closedarnoud-dv(GitHub profile, opens in a new tab)wants to merge 10 commits intomain fromrefs/pull/9893/headopened View on GitHub

Showing 25 changed files with 7 additions and 4 deletions (loading 22).

x
0 of 25 viewed, 25 left
5 additions and 0 deletions.changeset/deep-crews-open.mdAdded
View file
@@ -0,0 +1,5 @@
+---
+'@tanstack/angular-query-experimental': minor
+---
+​
+require Angular v19+ and use Angular component effect scheduling
1 addition and 3 deletionsdocs/framework/angular/guides/testing.mdModified
View file
@@ -9,8 +9,6 @@
​
This means tests and SSR can wait until mutations and queries resolve. In unit tests you can use `ApplicationRef.whenStable()` or `fixture.whenStable()` to await query completion. This works for both Zone.js and Zoneless setups.
​
-> This integration requires Angular 19 or later. Earlier versions of Angular do not support `PendingTasks`.
-​
## TestBed setup
​
Create a fresh `QueryClient` for every spec and provide it with `provideTanStackQuery` or `provideQueryClient`. This keeps caches isolated and lets you change default options per test:
@@ -31,7 +29,7 @@
​
> If your applications actual TanStack Query config is used in unit tests, make sure `withDevtools` is not accidentally included in test providers. This can cause slow tests. It is best to keep test and production configs separate.
​
-If you share helpers, remember to call `queryClient.clear()` (or build a new instance) in `afterEach` so data from one test never bleeds into another.
+If you share helpers, remember to call `queryClient.clear()` (or build a new instance) in `afterEach` so data from one test never bleeds into another. Prefer creating a fresh `QueryClient` per test: clearing only removes cached data, not custom defaults or listeners, so a reused client can leak configuration changes between specs and make failures harder to reason about. A new client keeps setup explicit and avoids any “invisible globals” influencing results.