T
TanStack•3y ago
correct-apricot

createWebStoragePersistor on React-Query v3

Hi everyone, I was wondering if i could get some help regarding using WebStorage Persitance in React query v3. The idea is we have multiple modules in using RQ, but i want to only persist in cache a subset of calls starting with the following key
/module/
/module/
. How could i do this ?
8 Replies
multiple-amethyst
multiple-amethyst•3y ago
persister accepts dehydrateOptions, which allows to filter queries that should be stored
correct-apricot
correct-apricotOP•3y ago
COuld you maybe help me write that code down ?
multiple-amethyst
multiple-amethyst•3y ago
let's do the following please: consult the docs and the typescript types, and then post the code you have and I'll see if it checks out
correct-apricot
correct-apricotOP•3y ago
Sure thing !
correct-apricot
correct-apricotOP•3y ago
How about like this ?
No description
correct-apricot
correct-apricotOP•3y ago
Or is it better with the Hash Startwith
No description
multiple-amethyst
multiple-amethyst•3y ago
yeah you can do both. does it work? just fyi, the persisters got a lot better in v4 😅
correct-apricot
correct-apricotOP•3y ago
I know, I am stuck with v3 on this project unfortunately... Thanks for the help though 🙂 I will test now It works ! Thanks 🙂

Did you find this page helpful?