Replies: 1 comment 2 replies
-
@niicojs using import {mutate} from 'swr'
// init DB
db.connect()
// ...
// patch states to cache
const state = await db.query(.....)
mutate(key, state, false) swr might try to bring customized cache in the future (I guess?), any thoughts or requirements are welcomed to post here. |
Beta Was this translation helpful? Give feedback.
2 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.
-
Hi guys,
I'm trying to add offline capabilities to a small app I made that use SWR.
What I have in mind is using IndexedDB as a local cache provider.
A solution would be adding cache update and fallback into the fetcher func, but it seems heavy for something that I guess already exists somewhere.
Or maybe populate SWR at startup from DB and update cache in fetcher so I don't have to test is we are online in fetcher.
How are you guys doing this?
Thanks,
Beta Was this translation helpful? Give feedback.
All reactions