Is there inbuilt function to get the persisted data? #7771
Unanswered
maddyahmad
asked this question in
Q&A
Replies: 1 comment
-
you control the storage by passing |
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.
-
Is there any function, or way to get that persisted data from the storage?
Because when i refresh the page, it still calls the api. Even though i could prevent that using staletime, but i was just looking for an inbuilt function, so that I can use persited data in another page. Any solution apart from invalidateQueries would work, because if i refresh the page, invalidateQueries gives me undefined.
const ReactQueryProvider = ({ children }) => {
const [queryClient] = useState(() => new QueryClient({
defaultOptions: {
queries: {
gcTime: 1000 * 60 * 60 * 24, // 24 hours
},
},
}));
const persister = createSyncStoragePersister({
storage: window.localStorage,
})
return (
<PersistQueryClientProvider client={queryClient} persistOptions={{ persister }}>{children}
);
};
export default ReactQueryProvider;
Beta Was this translation helpful? Give feedback.
All reactions