snapshot of https://github.com/TanStack/query.git (main, 2026-09-16; blobs > 131072B omitted)
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

This commit is contained in:
upstream-mirror
2026-09-16 01:13:08 +05:00
commit 3a013ccdfe
3570 changed files with 490194 additions and 0 deletions

View File

@@ -0,0 +1,25 @@
<script lang="ts">
import { createQuery } from '@tanstack/svelte-query'
import { sleep } from '@tanstack/query-test-utils'
import type { StatelessRef, StatusResult } from '../utils.svelte.js'
let { states }: { states: StatelessRef<Array<StatusResult<string>>> } =
$props()
const query = createQuery(() => ({
queryKey: ['test'],
queryFn: () => sleep(10).then(() => 'fetched'),
initialData: 'initial',
// make sure that initial data is older than the hydration data
// otherwise initialData would be newer and takes precedence
initialDataUpdatedAt: 1,
}))
$effect(() => {
const snapshot = $state.snapshot(query)
states.current.push(snapshot)
})
</script>
<div>{query.data}</div>
<div>fetchStatus: {query.fetchStatus}</div>

View File

@@ -0,0 +1,19 @@
<script lang="ts">
import PersistQueryClientProvider from '../../src/PersistQueryClientProvider.svelte'
import InitialData from './InitialData.svelte'
import type { OmitKeyof, QueryClient } from '@tanstack/svelte-query'
import type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'
import type { StatelessRef, StatusResult } from '../utils.svelte.js'
interface Props {
queryClient: QueryClient
persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>
states: StatelessRef<Array<StatusResult<string>>>
}
let { queryClient, persistOptions, states }: Props = $props()
</script>
<PersistQueryClientProvider client={queryClient} {persistOptions}>
<InitialData {states} />
</PersistQueryClientProvider>