Fork me on GitHub
#re-frame
<
2018-10-29
>
urbanslug06:10:29

Hey, is there a way to change a variable in a go loop once it's starts running? Trying to change a var in a loop via a subscription but it sticks with the values it was intialized with.

zalky12:10:25

Hi all: what is the best way to schedule a fn to run once after all events have been handled, but before all subscriptions have been synced?

tavistock15:10:05

im not sure what all subs have been synced means but maybe you want https://github.com/Day8/re-frame-async-flow-fx

pcj16:10:37

Without more context, you can have 1 event to manipulate whatever data you're transforming dispatching into the fn you want to run as a side effect. And then have that event dispatch into setting your state.

pcj16:10:37

Without more context, you can have 1 event to manipulate whatever data you're transforming dispatching into the fn you want to run as a side effect. And then have that event dispatch into setting your state.

zalky17:10:12

@tavistock, @pcj, thanks for the response! More specifically: the reaction/subscription graph is batch updated via requestAnimationFrame, and I'm wondering if there's a way to hook into that to have a fn run before all the subscriptions are updated. There's next-tick, which does exactly that, but that is a one time thing. I could just set up recursive call to next-tick, but haven't seen that as a design pattern anywhere, so I was checking if there's some established way of scheduling something to run regularly.

zalky17:10:17

Dispatching to another event is a great suggestion, but this is not app state related, and it was something I specifically wanted to do before the reaction/subscription graph updated, but after all events have been processed in the queue.