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

Class Consumer

packages/lit-query/src/__tests__/useIsFetching.test.ts:45–59  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43 const key = createKey()
44
45 class Consumer extends LitElement {
46 readonly queryKey = key
47
48 readonly query = createQueryController(this, {
49 queryKey: this.queryKey,
50 queryFn: () => sleep(10).then(() => 'query-ok'),
51 retry: false,
52 })
53
54 readonly isFetching = useIsFetching(this, { queryKey: this.queryKey })
55
56 override render() {
57 return html`<p>fetching: ${this.isFetching()}</p>`
58 }
59 }
60
61 customElements.define(generateElementName(), Consumer)
62 const consumer = new Consumer()

Callers

nothing calls this directly

Calls 3

sleepFunction · 0.90
createQueryControllerFunction · 0.85
useIsFetchingFunction · 0.50

Tested by

no test coverage detected