Fork me on GitHub
#re-frame
<
2021-06-08
>
anonimitoraf04:06:06

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?

Oliver George05:06:25

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.

anonimitoraf09:06:35

> but I've been fine without local caching of data for webapps How so? What happens when a user refreshes a page?

Oliver George01:06:54

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)

mikethompson06:06:30

@nicdaoraf The todomvc example in the re-frame repo saves to local storage. Very simple example but perhaps indicative??

anonimitoraf09:06:46

Ah, thanks. I'll check that out