snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<script lang="ts">
|
||||
import { createQuery } from '@tanstack/svelte-query'
|
||||
import { sleep } from '@tanstack/query-test-utils'
|
||||
import { StatelessRef } from '../utils.svelte.js'
|
||||
|
||||
let { states }: { states: StatelessRef<Array<string>> } = $props()
|
||||
|
||||
const query = createQuery(() => ({
|
||||
queryKey: ['test'],
|
||||
queryFn: async () => {
|
||||
states.current.push('fetching')
|
||||
await sleep(10)
|
||||
states.current.push('fetched')
|
||||
return 'fetched'
|
||||
},
|
||||
}))
|
||||
</script>
|
||||
|
||||
<div>{query.data}</div>
|
||||
<div>fetchStatus: {query.fetchStatus}</div>
|
||||
@@ -0,0 +1,20 @@
|
||||
<script lang="ts">
|
||||
import PersistQueryClientProvider from '../../src/PersistQueryClientProvider.svelte'
|
||||
import AwaitOnSuccess from './AwaitOnSuccess.svelte'
|
||||
import type { OmitKeyof, QueryClient } from '@tanstack/svelte-query'
|
||||
import type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'
|
||||
import { StatelessRef } from '../utils.svelte'
|
||||
|
||||
interface Props {
|
||||
queryClient: QueryClient
|
||||
persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>
|
||||
onSuccess: () => Promise<void>
|
||||
states: StatelessRef<Array<string>>
|
||||
}
|
||||
|
||||
let { queryClient, persistOptions, onSuccess, states }: Props = $props()
|
||||
</script>
|
||||
|
||||
<PersistQueryClientProvider client={queryClient} {persistOptions} {onSuccess}>
|
||||
<AwaitOnSuccess {states} />
|
||||
</PersistQueryClientProvider>
|
||||
Reference in New Issue
Block a user