Support infinite cache time in RTK Query #2347
Replies: 5 comments 16 replies
-
I... actually think that should already work? :) I at least see a |
Beta Was this translation helpful? Give feedback.
-
I had answered this earlier, but seems GitHub ate my answer: We are doing math with that number, so |
Beta Was this translation helpful? Give feedback.
-
As a suggestion you can use localStorage or something else. |
Beta Was this translation helpful? Give feedback.
-
👀 |
Beta Was this translation helpful? Give feedback.
-
Hi @agusterodin , have you found a way to keep cache on unmounted components, I have a list of options on the Modal and don't want to fetch every time the modal opens. (no luck with large number |
Beta Was this translation helpful? Give feedback.
-
Hey, there are certain endpoints that I wish to cache the results infinitely. I understand that keeping stale data around is generally not advised but it would be really nice to be able to keep certain data around even when all subscribed components are unmounted. The less I have to show loading skeletons for situations where stale data isn't too misleading, the better.
My current workaround is to just keep an additional, unused hook subscription in my Next app's _app.tsx file (not ideal). I understand that creating a dummy "infinite data subscriber" component would be better since it would cause potential rerenders of the entire application (still not ideal).
Something like this would be awesome:
Infinity
is already a valid value in JavaScript so this shouldn't require any type changes :DBeta Was this translation helpful? Give feedback.
All reactions