Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

inject-query-zone.ts

10 lines331 Bytes

1import { NgZone, inject } from '@angular/core'
2​
3/**
4 * Keeps Query's background timers out of Angular's stability tracking.
5 * @returns A function that runs callbacks outside the injected NgZone.
6 */
7export function injectQueryZone() {
8 const ngZone = inject(NgZone)
9 return <T>(fn: () => T): T => ngZone.runOutsideAngular(fn)