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 notice for SWR, it only supports provide cache source directly by providing a storage instance.
However, I have a use case that I wanna use SWR in a web extension. Since in web extension, all requests are actually being made from the background scripts, using SWR would not do any thing as every time when opening the pop up, it will act like a new page load. Thus, I have to create some storage/cache instance on the backend script end to cache responses and at the same time, I would like to utilize the invalidation from SWR to handle any actions and updates. Hence, would like to ask for a way to utilize some storage through functions instead of the storage directly.
i.e. instead of directly provide new Map(), we can have something liike
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,
I notice for SWR, it only supports provide cache source directly by providing a storage instance.
However, I have a use case that I wanna use SWR in a web extension. Since in web extension, all requests are actually being made from the background scripts, using SWR would not do any thing as every time when opening the pop up, it will act like a new page load. Thus, I have to create some storage/cache instance on the backend script end to cache responses and at the same time, I would like to utilize the invalidation from SWR to handle any actions and updates. Hence, would like to ask for a way to utilize some storage through functions instead of the storage directly.
i.e. instead of directly provide
new Map()
, we can have something liikesince there is no direct way to get the storage from the background script on frontend.
I am not sure if it is supported by someway or not, or there is other better way to solve this problem.
Thanks.
Beta Was this translation helpful? Give feedback.
All reactions