Skip to content
Source
Sign inSign up
TanStack/query
Open History to see the last commit

isRestoring.ts

13 lines579 Bytes

1import { createContext, useContext } from 'octane'
2​
3// IsRestoring β€” true while a persisted client is being restored from storage. While
4// restoring, queries read the cache but don't subscribe/fetch (they wait for the
5// restore to finish). Defaults to false, so without a provider it's inert.
6const IsRestoringContext = createContext(false)
7​
8export function useIsRestoring(): boolean {
9 return useContext(IsRestoringContext)
11​
12// `<IsRestoringProvider value={true}>…` β€” octane's built-in context Provider.
13export const IsRestoringProvider = IsRestoringContext.Provider