Open History to see the last commit
1'use client'
2import * as React from 'react'
3β
4const IsRestoringContext = React.createContext(false)
5β
6/**
7 * If you are using `PersistQueryClientProvider`, you can also use the
8 * `useIsRestoring` hook alongside it to check if a restore is currently in
9 * progress. `useQuery` and friends also check this internally to avoid race
10 * conditions between the restore and mounting queries.
11 *
12 * @returns `true` while a persisted client is being restored, `false`
13 * otherwise.
14 */
15export const useIsRestoring = () => React.useContext(IsRestoringContext)
16β
17/**
18 * The Provider that `PersistQueryClientProvider` uses to signal whether a
19 * persisted client is currently being restored, read by `useIsRestoring`.
20 */
21export const IsRestoringProvider = IsRestoringContext.Provider