How to use persistQueryClient?
MaximilianLloyd opened this issue · 3 comments
MaximilianLloyd commented
Hi. I was wondering how you can use the persistQueryClient functionality with this?
NetanelBasal commented
As in React, I guess. Provide the function what it needs.
MaximilianLloyd commented
Ok, this is what i currently have. But it doesn't seem to be working
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: Infinity,
refetchOnWindowFocus: false
}
}
});
const persister = createSyncStoragePersister({
storage: window.localStorage,
serialize: (data) => compress(JSON.stringify(data)),
deserialize: (data) => JSON.parse(decompress(data))
});
persistQueryClient({ queryClient, persister: persister , maxAge: Infinity });
persistQueryClientRestore({ queryClient, persister: persister });
and
providers: [
provideQueryClient(queryClient)
]
NetanelBasal commented
Can you provide a stackblitz, please?