Hey guys, I've tried googling around but had no luck.
How do you handle page refreshes? re-frame
(just like redux
) gets its state blown away, but it seems like people have written packages to serialize state and save into local storage (like https://github.com/rt2zz/redux-persist).
My last resort is writing something like that^ myself
Are there better ways of solving this problem?
Probably not the answer you're after but I've been fine without local caching of data for webapps. Mobile apps are another case - I use sqlite for my #cljsrn apps. I also watch #datahike to see if they release a gamechanging datalog based persistance for web/mobile apps.
> but I've been fine without local caching of data for webapps How so? What happens when a user refreshes a page?
We don't have an "offline first" approach to our webapp. It's essentially a nice interface to a REST API. Refreshing the browser bootstraps the app which fetches any data it needs. Our data model is complicated. This approach would generate a lot of requests except that we've provided a "pull api" mode which amounts to a poor-mans GraphQL. Goal is saving query count (at the cost of complicating bakend db queries)
@nicdaoraf The todomvc example in the re-frame repo saves to local storage. Very simple example but perhaps indicative??
Ah, thanks. I'll check that out