T
TanStack2y ago
xenial-black

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
fair-rose
fair-rose2y 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.
conscious-sapphire
conscious-sapphire2y ago
experimental_createPersister | TanStack Query Docs
Installation This utility comes as a separate package and is available under the '@tanstack/query-persist-client-core' import.
xenial-black
xenial-blackOP2y ago
This is exactly what I needed, thank you !
typical-coral
typical-coral2y ago
Hi it does mean that currently we can not use the experimental createPersister with persister option in Angular ?
conscious-sapphire
conscious-sapphire2y 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.

Did you find this page helpful?