Expose restoration progress to descendants
Persisted-cache startup
TanStack · Class
IsRestoringProvider is the Solid context provider for persisted query-client restoration state. It exposes an accessor<boolean> that useIsRestoring and query primitives can consume.
IsRestoringProvider is the Solid context provider used to expose persisted-client restoration state. PersistQueryClientProvider supplies this state, while useIsRestoring reads it and query primitives use it internally to avoid restore-related races.
const IsRestoringProvider: ContextProviderComponent<Accessor<boolean>> = IsRestoringContext.Provider;import { createSignal } from "solid-js";
import { IsRestoringProvider, useIsRestoring } from "@tanstack/solid-query";
function RestoreStatus() {
const restoring = useIsRestoring();
return <span>{restoring() ? "Restoring…" : "Ready"}</span>;
}
export function App() {
const [isRestoring] = createSignal(false);
return (
<IsRestoringProvider value={isRestoring}>
<RestoreStatus />
</IsRestoringProvider>
);
}Provides a Solid accessor through context so a descendant can read whether persisted query state is being restored.
Persisted-cache startup
Custom persistence integration
Loading-state coordination
It is a Solid context provider whose value has type Accessor<boolean>. Its purpose is to expose whether a persisted query client is currently being restored.
Follow-up: How is the value normally populated? PersistQueryClientProvider uses this provider to publish the restore state.
The provider communicates restoration status to descendants through context. useIsRestoring reads that status, while query APIs also check it internally.
Follow-up: Why does that internal check matter? It helps prevent race conditions between restoring persisted state and mounting queries.
The documented declaration is const IsRestoringProvider: ContextProviderComponent<Accessor<boolean>> = IsRestoringContext.Provider;. Therefore, the supplied value is a Solid accessor returning a boolean.
Follow-up: What should the accessor return? It should be true during persisted-client restoration and false once restoration has finished.
PersistQueryClientProvideruseIsRestoringIsRestoringContext