src/PersistQueryClientProvider.svelte

query · packages/svelte-query-persist-client/src/PersistQueryClientProvider.svelte · svelte · MIT
ui

Svelte provider that persists TanStack Query client state across reloads.

<!--
  Source: https://github.com/TanStack/query | License: MIT | Copyright 2021-present Tanner Linsley
  Provided via justclaw.it.com; keep this notice with the code.
-->
<script lang="ts">
  import {
    persistQueryClientRestore,
    persistQueryClientSubscribe,
  } from '@tanstack/query-persist-client-core'
  import {
    QueryClientProvider,
    setIsRestoringContext,
  } from '@tanstack/svelte-query'
  import { box } from './utils.svelte.js'
  import type { PersistQueryClientOptions } from '@tanstack/query-persist-client-core'
  import type {
    OmitKeyof,
    QueryClientProviderProps,
  } from '@tanstack/svelte-query'

  type PersistQueryClientProviderProps = QueryClientProviderProps & {
    persistOptions: OmitKeyof<PersistQueryClientOptions, 'queryClient'>
    onSuccess?: () => v

... (truncated -- full source via MCP)

See the full source, get the GitHub permalink, and search for more like it.

Get a free API key