How to asynchronously deserialize data when using createWebStoragePersister #3692
Unanswered
aubreyzulu
asked this question in
Q&A
Replies: 1 comment
-
I don't think its possible at the moment. however, |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
` import { QueryClient } from 'react-query';
import { persistQueryClient } from 'react-query/persistQueryClient'
import { createWebStoragePersister } from 'react-query/createWebStoragePersister'
import { compress, decompress } from 'lz-string';
const queryClient = new QueryClient({ defaultOptions: { queries: { staleTime: Infinity } } });
persistQueryClient({
queryClient: connectionsQueryClient,
persistor: createWebStoragePersister({
storage: window.localStorage,
serialize: data => compress(JSON.stringify(data)),
deserialize: data => JSON.parse(decompress(data)),
}),
maxAge: Infinity,
});`
Beta Was this translation helpful? Give feedback.
All reactions