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

Function Page

packages/solid-query/src/__tests__/suspense.test.tsx:38–65  ·  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
59 aria-label="toggle"
60 onClick={() => setStateKey(createKey())}
61 />
62 data: {String(state.data)}
63 </div>
64 )
65 }
66
67 const rendered = renderWithClient(queryClient, () => (
68 <Suspense fallback="loading">

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected