Files
upstream-mirror 3a013ccdfe
Some checks failed
autofix.ci / autofix (push) Failing after 4s
Release / Release (push) Has been skipped
GitHub Actions Security Analysis / Run zizmor (push) Failing after 2s
snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
2026-09-16 01:13:08 +05:00

35 lines
1.1 KiB
Svelte

<script lang="ts">
import { onDestroy, onMount } from 'svelte'
import type { QueryClient } from '@tanstack/query-core'
import { createQuery, setQueryClientContext } from '../../src/index.js'
import type { Accessor, CreateQueryOptions } from '../../src/index.js'
type Props = {
queryClient: QueryClient
options1: Accessor<CreateQueryOptions>
options2: Accessor<CreateQueryOptions>
}
let { queryClient, options1, options2 }: Props = $props()
setQueryClientContext(queryClient)
onMount(() => queryClient.mount())
onDestroy(() => queryClient.unmount())
const query1 = createQuery(options1)
const query2 = createQuery(options2)
</script>
<button onclick={() => query1.refetch()}>refetch1</button>
<div data-testid="status1">{query1.status}</div>
<div data-testid="fetchStatus1">{query1.fetchStatus}</div>
<div data-testid="data1">{query1.data ?? 'undefined'}</div>
<div data-testid="isStale1">{query1.isStale}</div>
<div data-testid="status2">{query2.status}</div>
<div data-testid="fetchStatus2">{query2.fetchStatus}</div>
<div data-testid="data2">{query2.data ?? 'undefined'}</div>
<div data-testid="isStale2">{query2.isStale}</div>