How to persist data to IndexedDB ?
Hi, I was using this utility function to persist data to IndexedDB
https://github.com/TanStack/query/discussions/1638
But after updating Angular Query from 5.16.1 to 5.17.9, this no longer works, With the latest version the cached data never appears but there is no loading either, when trying to refresh I see a glimpse of the data that should have been there before the refresh completes
The data shows properly in the devtools however, so it means the
data
signals are not emitting new data.GitHub
Cache Persistence in IndexedDB · TanStack query · Discussion #1638
React query have experiemental cache persistence using local storage. However in our application we have large data cached and local storage has max storage limit of 5mb. In order to store large am...
5 Replies
ratty-blush•2y ago
Hi, the other adapters have code for this. The Angular one doesn't. If you could provide me with a minimal Angular application using client persistence that would help me with testing an implementation.
rising-crimson•2y ago
You could try framework agnostic way with https://tanstack.com/query/latest/docs/react/plugins/createPersister
experimental_createPersister | TanStack Query Docs
Installation
This utility comes as a separate package and is available under the '@tanstack/query-persist-client-core' import.
flat-fuchsiaOP•2y ago
This is exactly what I needed, thank you !
harsh-harlequin•17mo ago
Hi it does mean that currently we can not use the experimental createPersister with persister option in Angular ?
rising-crimson•17mo ago
It should work, as it's implemented in framework agnostic way.
But API might change in the future as we need to expose some additional functionality.