* docs(query-core): add JSDoc across the package and expose it in generated reference docs * docs(config.json): add sidebar entries for newly generated query-core reference docs * docs(query-core): migrate remaining prose from the legacy 'docs/reference' pages into JSDoc * docs(query-core): remove legacy 'docs/reference' pages superseded by the generated reference * docs(query-core): regenerate reference docs after merging main * docs(query-core): document missing default values for MutationOptions, combine, and QueryFilters.type * fix(query-devtools): drop unnecessary 'query-core' project reference * docs(query-core): document missing default values and normalize 'Defaults to' spacing * docs(query-core): fix 'environmentManager' JSDoc example
1.6 KiB
| id | title |
|---|---|
| useIsMutating | useIsMutating |
function useIsMutating(
host,
filters,
queryClient?): IsMutatingAccessor;
Defined in: packages/lit-query/src/useIsMutating.ts:147
Creates a Lit reactive controller that tracks how many matching mutations are currently pending.
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
resolves the client from the nearest connected QueryClientProvider.
Parameters
host
ReactiveControllerHost
The Lit reactive controller host that owns the cache subscription.
filters
Accessor<MutationFilters<unknown, Error, unknown, unknown>> = {}
Mutation filters, or a getter that returns mutation filters.
queryClient?
Optional explicit query client. Provide this for controllers that should not resolve a client from Lit context.
Returns
An accessor for the current number of matching pending mutations.
Example
import { LitElement, html } from 'lit'
import { useIsMutating } from '@tanstack/lit-query'
class MutationStatus extends LitElement {
private readonly savesPending = useIsMutating(this, {
mutationKey: ['save-project'],
})
render() {
return html`<span>${this.savesPending()} saves pending</span>`
}
}