Fork me on GitHub
#fulcro
<
2021-06-18
>
donavan17:06:23

Can I just check my assumptions: inside a UISM handler it should be fine to swap!on the state atom in (-> env ::uism/app ::application/state-atom) ? I’m doing that and I can see the updated atom change to what I expect via a watcher on the state atom and by derefing it in the handler but the state atom then reverts to the old value (which I can also see happening in the watcher call back)

3
Jakub Holý (HolyJak)17:06:22

I don't know. I only know these rules: Make sure not to use transact![!]; use only apply-action and trigger-remote-mutation.

donavan18:06:23

Thanks… I wonder if I’m reading this correctly to mean that I can swap on the state atom: “Your state machine handlers are already an implementation of the client side operations of a mutation, so really what we need is a way to trigger a remote mutation and then trigger events based on the outcome.” …that seems to agree with what you’re saying “Make sure to not use transact!“.

donavan18:06:23

Oh wait, I hadn’t notice apply-action

donavan18:06:13

That’s it, you can’t swap! you must use uism/apply-action Thanks @U0522TWDA!

🎉 3