You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using SWR for a project and it has been mostly a great experience. I am having one problem where I make a query that has a set of filters applied to it. These queries are applied as query parameters, so they get put into the key that SWR caches.
The problem I have is that I don't think SWR ever evicts any combination of filters from the cache. This means that if someone uses the site for a while, the cached data will grow forever until the browser dies with OOM.
What are the best practices for handling a situation like this? Ideally I would let SWR cache most keys normally, but for keys matching some prefix, I would only cache 2 or 3 of them. Should this be handled with cache provider or some kind of middleware or something else?
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi Guys,
I am using SWR for a project and it has been mostly a great experience. I am having one problem where I make a query that has a set of filters applied to it. These queries are applied as query parameters, so they get put into the key that SWR caches.
The problem I have is that I don't think SWR ever evicts any combination of filters from the cache. This means that if someone uses the site for a while, the cached data will grow forever until the browser dies with OOM.
What are the best practices for handling a situation like this? Ideally I would let SWR cache most keys normally, but for keys matching some prefix, I would only cache 2 or 3 of them. Should this be handled with cache provider or some kind of middleware or something else?
Beta Was this translation helpful? Give feedback.
All reactions