correct-apricot
correct-apricot10mo ago

How to reset cache after navigating to a new page

I am using useSimpleList to fetch some data. When I navigate to a new page using useNavigation hook from refine, and then come back to the original page, I want the useSimpleList to be updated but it keeps with the old data
2 Replies
kapa.ai
kapa.ai10mo ago
Hi @Facu. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave: ---------------------- You can use the syncWithLocation feature of the useSimpleList hook to automatically update the state of the list when the URL changes. This feature encodes the state of the list (e.g., sort order, filters, pagination) in the query parameters of the URL. When the URL changes, the useSimpleList state is automatically updated to match. This feature is set to false by default, so you'll need to set it to true to use it. Here's how you can enable it:
useSimpleList({
syncWithLocation: true,
});
useSimpleList({
syncWithLocation: true,
});
You can also set this value globally on the <Refine> component. For more information, refer to the documentation (https://refine.dev/docs/ui-integrations/ant-design/hooks/use-simple-list/#syncwithlocation). ---------------------- Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: ----------------------
kapa.ai
kapa.ai10mo ago
<@411223164698492929> kapa.ai is still learning and improving, please let us know how it did by reacting below