(props: { wait: number })
| 15 | } |
| 16 | const baseUrl = getBaseURL() |
| 17 | function useWaitQuery(props: { wait: number }) { |
| 18 | const query = useSuspenseQuery({ |
| 19 | queryKey: ['wait', props.wait], |
| 20 | queryFn: async () => { |
| 21 | const path = `/api/wait?wait=${props.wait}` |
| 22 | const url = baseUrl + path |
| 23 | |
| 24 | const res: string = await ( |
| 25 | await fetch(url, { |
| 26 | cache: 'no-store', |
| 27 | }) |
| 28 | ).json() |
| 29 | return res |
| 30 | }, |
| 31 | }) |
| 32 | |
| 33 | return [query.data as string, query] as const |
| 34 | } |
| 35 | |
| 36 | function MyComponent(props: { wait: number }) { |
| 37 | const [data] = useWaitQuery(props) |
no test coverage detected
searching dependent graphs…