MCPcopy Create free account
hub / github.com/TanStack/query / Consumer

Class Consumer

packages/lit-query/src/__tests__/useMutationState.test.ts:145–157  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143 const mutationKey = createKey()
144
145 class Consumer extends LitElement {
146 readonly mutationKey = mutationKey
147
148 readonly mutation = createMutationController(this, {
149 mutationKey: this.mutationKey,
150 mutationFn: () => sleep(10).then(() => 'mutation-ok'),
151 })
152
153 readonly mutationStatuses = useMutationState<string>(this, {
154 filters: { mutationKey: this.mutationKey },
155 select: (mutation) => mutation.state.status,
156 })
157 }
158
159 customElements.define(generateElementName(), Consumer)
160 const consumer = new Consumer()

Callers

nothing calls this directly

Calls 3

sleepFunction · 0.90
createMutationControllerFunction · 0.85
useMutationStateFunction · 0.50

Tested by

no test coverage detected