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

Function Page

packages/solid-query/src/__tests__/suspense.test.tsx:38–62  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

36 let renders = 0
37
38 function Page() {
39 const [stateKey, setStateKey] = createSignal(key)
40
41 const state = useQuery(() => ({
42 queryKey: stateKey(),
43 queryFn: () => sleep(10).then(() => ++count),
44 }))
45
46 createRenderEffect(() => {
47 states.push({ ...state })
48 })
49
50 createRenderEffect(
51 on([() => ({ ...state }), () => key], () => {
52 renders++
53 }),
54 )
55
56 return (
57 <div>
58 <button aria-label="toggle" onClick={() => setStateKey(queryKey())} />
59 data: {String(state.data)}
60 </div>
61 )
62 }
63
64 const rendered = renderWithClient(queryClient, () => (
65 <Suspense fallback="loading">

Callers

nothing calls this directly

Calls 5

sleepFunction · 0.90
queryKeyFunction · 0.90
useQueryFunction · 0.50
useInfiniteQueryFunction · 0.50
resetQueriesMethod · 0.45

Tested by

no test coverage detected