(re-frame/dispatch-sync [::re-graph/init {}])?
opened this issue · comments
Deleted user commented
Should ::re-graph/init
be dispatched using dispatch-sync
to ensure it completes before my code executes any subscriptions (e.g.)?
Oliver Hine commented
Hi,
Yes, it needs to be initialised before anything tries to use it. I init it with a normal dispatch
and it works fine but it probably depends on how your code is arranged.
Deleted user commented
@mike-thompson-day8 says that events are handled in a FIFO manner and points to a comment in the source of re-frame.router
for a more detailed explanation: https://github.com/Day8/re-frame/blob/e539ff6548acd014f9c3da5797918fa5fa4eb818/src/re_frame/router.cljc#L8-L61
Hence simply ordering the dispatches correctly will usually be sufficient.