Open brjann opened 2 years ago
Hm, that’s an interesting case. I think you could even say that theoretically the transition could happen before the start because re-frame doesn’t guarantee order? But I think your analysis is correct, start has not finished the things it needs to do before transition happens.
The immediate suggestion, without looking further into this, would be to either separate the 2 events, or just have the start state of the fsm be whatever some-event
causes.
Thanks!
I think you could even say that theoretically the transition could happen before the start because re-frame doesn’t guarantee order?
Oh, I was pretty sure that events in dispatch-n
are guaranteed order?
Edit: They are: https://day8.github.io/re-frame/api-builtin-effects/
have the start state of the fsm be whatever
some-event
causes.
Yes, that is actually what I did. For different reasons I would have liked to be able to dispatch like that, but your suggested method also works. I just wanted you to know of this potential race condition if it is not intended.
I'm switching from
kee-frame.fsm.alpha
tore-statecharts
and this far I really like the new library!I think I have stumbled upon a race condition though. I cannot return this from an effect
The
:some-event
transition does not happen. I guess becausers/integrate
does not start the fsm immediately but instead dispatches::rs/init
which will get executed after my call to::rs/transition