API reference > @kontsedal/olas-persist > restoreQueryCache
restoreQueryCache() function
Read the stored cache ahead of createRoot, for storage that reads asynchronously (IndexedDB). Resolves with a DehydratedState forcreateRoot({ hydrate }), or undefined when there is nothing to restore.
ts
const storage = indexedDbAdapter()
const hydrate = await restoreQueryCache({ storage })
const root = createRoot(app, {
deps,
queries: queryEngine(),
hydrate,
plugins: [persistQueryCachePlugin({ storage, restore: false })],
})Signature:
typescript
export declare function restoreQueryCache(options?: PersistQueryCacheOptions): Promise<DehydratedState | undefined>;Parameters
Parameter | Type | Description |
|---|---|---|
options | (Optional) |
Returns:
Promise<DehydratedState | undefined>