#createWebStoragePersistor on React-Query v3

12 messages · Page 1 of 1 (latest)

lone oyster
#

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/.

How could i do this ?

lapis dock
#

persister accepts dehydrateOptions, which allows to filter queries that should be stored

lone oyster
#

COuld you maybe help me write that code down ?

lapis dock
#

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

lone oyster
#

Sure thing !

#

How about like this ?

#

Or is it better with the Hash Startwith

lapis dock
#

yeah you can do both. does it work?

#

just fyi, the persisters got a lot better in v4 😅

lone oyster
#

I know, I am stuck with v3 on this project unfortunately... Thanks for the help though 🙂

#

I will test now

lone oyster
#

It works !