Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/great-ghosts-ring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@tanstack/query-core": patch
---

Honour explicit `fetchStatus` filters in `QueryClient.isFetching` and framework fetching counters. Passing `'paused'` or `'idle'` now counts queries in that status; omitted or `undefined` values still default to `'fetching'`.
77 changes: 39 additions & 38 deletions docs/framework/angular/reference/classes/QueryClient.md

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ function injectIsFetching(filters?: QueryFilters<readonly unknown[]>, options?:
Defined in: [packages/angular-query-experimental/src/inject-is-fetching.ts:63](https://github.com/TanStack/query/blob/main/packages/angular-query-experimental/src/inject-is-fetching.ts#L63)

Injects a signal that tracks the number of queries that your application is loading or fetching in the
background (useful for app-wide loading indicators).
background by default (useful for app-wide loading indicators).

## Parameters

### filters?

[`QueryFilters`](../interfaces/QueryFilters.md)\<readonly `unknown`[]\>

The [QueryFilters](../interfaces/QueryFilters.md) to narrow down the matched queries.
The [QueryFilters](../interfaces/QueryFilters.md) to narrow down the matched queries. `fetchStatus` defaults to
`'fetching'` when omitted or `undefined`; set it to `'paused'` or `'idle'` to count queries in that status instead.

<a id="filters-properties"></a>

Expand Down Expand Up @@ -53,8 +54,7 @@ Additional configuration

`Signal`\<`number`\>

A `Signal` with the number of queries that your application is currently loading or fetching in
the background.
A `Signal` with the number of matching queries with the requested `fetchStatus`.

## Examples

Expand Down
77 changes: 39 additions & 38 deletions docs/framework/lit/reference/classes/QueryClient.md

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions docs/framework/lit/reference/functions/useIsFetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ function useIsFetching(
): IsFetchingAccessor;
```

Defined in: [packages/lit-query/src/useIsFetching.ts:141](https://github.com/TanStack/query/blob/main/packages/lit-query/src/useIsFetching.ts#L141)
Defined in: [packages/lit-query/src/useIsFetching.ts:142](https://github.com/TanStack/query/blob/main/packages/lit-query/src/useIsFetching.ts#L142)

Creates a Lit reactive controller that tracks how many matching queries are
currently fetching.
currently fetching by default.

When `filters` is a function, it is re-read during host updates so the count
can follow reactive host state. If `queryClient` is omitted, the controller
Expand All @@ -35,7 +35,8 @@ subscription.

[`Accessor`](../type-aliases/Accessor.md)\<[`QueryFilters`](../interfaces/QueryFilters.md)\<readonly `unknown`[]\>\> = `{}`

Query filters, or a getter that returns query filters.
Query filters, or a getter that returns query filters. `fetchStatus` defaults to
`'fetching'` when omitted or `undefined`; set it to `'paused'` or `'idle'` to count queries in that status instead.

<a id="filters-properties"></a>

Expand All @@ -54,7 +55,7 @@ controllers that should not resolve a client from Lit context.

[`IsFetchingAccessor`](../type-aliases/IsFetchingAccessor.md)

An accessor for the current number of matching fetching queries.
An accessor for the number of matching queries with the requested `fetchStatus`.

## Example

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Defined in: [packages/lit-query/src/useIsFetching.ts:13](https://github.com/TanS
Accessor returned by `useIsFetching`.

Call the accessor or read its `current` property to get the number of
currently fetching queries that match the filters.
queries that match the filters, defaulting to currently fetching queries.

## Type Declaration

Expand Down
77 changes: 39 additions & 38 deletions docs/framework/preact/reference/classes/QueryClient.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions docs/framework/preact/reference/functions/useIsFetching.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ function useIsFetching(filters?: QueryFilters<readonly unknown[]>, queryClient?:
Defined in: [packages/preact-query/src/useIsFetching.ts:41](https://github.com/TanStack/query/blob/main/packages/preact-query/src/useIsFetching.ts#L41)

The `useIsFetching` hook returns the `number` of the queries that your application is loading or fetching in
the background (useful for app-wide loading indicators).
the background by default (useful for app-wide loading indicators).

## Parameters

### filters?

[`QueryFilters`](../interfaces/QueryFilters.md)\<readonly `unknown`[]\>

The [QueryFilters](../interfaces/QueryFilters.md) to narrow down the matched queries.
The [QueryFilters](../interfaces/QueryFilters.md) to narrow down the matched queries. `fetchStatus` defaults to
`'fetching'` when omitted or `undefined`; set it to `'paused'` or `'idle'` to count queries in that status instead.

<a id="filters-properties"></a>

Expand All @@ -46,8 +47,7 @@ be used.

`number`

Will be the `number` of the queries that your application is currently loading or fetching in the
background.
The `number` of matching queries with the requested `fetchStatus`.

## Examples

Expand Down
Loading