re-frame

https://github.com/Day8/re-frame/blob/master/docs/README.md https://github.com/Day8/re-frame/blob/master/docs/External-Resources.md
uosl 2020-11-06T11:03:47.287600Z

It sounds to me like what you want is load-on-mount or rather, load-on-sub? It's possible to do, but re-frame encourages you to be more low-level and load (query the server) the data manually by dispatching an event before or when you'll need the data. https://day8.github.io/re-frame/FAQs/LoadOnMount/

uosl 2020-11-06T11:04:40.287900Z

You might get closer to your ideal by dispatching on route change, which with reitit frontend you can do using the start function of the controller.

Ivan Fedorov 2020-11-06T12:54:21.288400Z

@regen hey, thanks for the input! That’s what I do, actually. My case is about converting window.scrollY into time offset and building the UI for that or querying the server with new date boundaries. App demo here: https://lightpad.ai/w/timeflow/page/timeflow ATM I have one dispatch call from one sub computation function. When you scroll past certain amount of dates – an event will be dispatched to apply new date boundaries to the db. Otherwise, I would need to store a lot more state in the app-db and I fear performance degradation here.

Ivan Fedorov 2020-11-06T12:58:09.288700Z

Again, while it look like anti-pattern to me, I think this can work, when all measures are taken to prevent circular computation.

p-himik 2020-11-06T14:15:57.289100Z

An interesting issue with global interceptors - it seems that the current API is not code reloading friendly. Calling reg-global-interceptor multiple times with the same exact interceptor (which is exactly what happens with code reloading) will add multiple copies of the same interceptor to the global interceptors queue.