* docs(*): add parameter and result property tables to reference function pages and an overview to overloaded ones * docs(*): link to the base type's properties when a parameter or result type has no property table * docs(framework/*/reference): regenerate reference docs * docs(framework/*/reference): regenerate reference docs * chore(scripts/generate-docs): restore the 'dirname' import that the merge dropped * docs(framework/*/reference): regenerate reference docs * docs(scripts/generate-docs): label overloads in the overview with their declared parameter and return types * docs(framework/*/reference): regenerate reference docs * docs(scripts/generate-docs): convert declared intersection types from the source so signatures keep their alias names * docs(framework/*/reference): regenerate reference docs * docs(scripts/generate-docs): reword a comment to avoid the unknown word 'inlines' * docs(scripts/generate-docs): skip a parameter table on overloaded pages when its heading is missing
1.8 KiB
| id | title |
|---|---|
| useIsMutating | useIsMutating |
function useIsMutating(
host: ReactiveControllerHost,
filters?: Accessor<MutationFilters<unknown, Error, unknown, unknown>>,
queryClient?: QueryClient): IsMutatingAccessor;
Defined in: packages/lit-query/src/useIsMutating.ts:141
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.
filters properties
Built from MutationFilters. See the type above for what it changes.
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>`
}
}