Open History to see the last commit
1<script lang="ts">
2 import { createQuery, setQueryClientContext } from '../../src/index.js'
3 import type { QueryClient } from '@tanstack/query-core'
4 import type { Accessor, CreateQueryOptions } from '../../src/index.js'
5β
6 type Data = { name: string }
7β
8 type Props = {
9 queryClient: QueryClient
10 options: Accessor<CreateQueryOptions<Data, Error, string>>
11 }
12β
13 let { queryClient, options }: Props = $props()
14β
15 setQueryClientContext(queryClient)
16β
17 const query = createQuery<Data, Error, string>(options)
18</script>
19β
20<div data-testid="status">{query.status}</div>
21<div data-testid="data">{query.data ?? 'undefined'}</div>
22<div data-testid="error">
23 {(query.error as Error | null)?.message ?? 'null'}
24</div>