Just found add-route-target! which turned out to be the crucial step to solve my dynamic routing problem... In case anyone else comes across this - there is a small issue with the mutation "add-route-target" in the dynamic-routing ns of Fulcro The last line of the mutation is
(swap! state add-route-target* router target)
but the "add-route-target*" method is expecting [state-map options]
so, pulling the router and target out of the options rather than them being sent separately
the workaround is simple, just make the :router key in the original call point to an options map rather than a class or register key
{:router {:router classorreg :target classorreg}}
Oopps. That sounds like an actual bug
Does it make sense to want to look at a statechart configuration from within the statechart (decide which transition to take based on which (parallel) state we are in)?
Eg in the statechart book there https://fulcrologic.github.io/statecharts/#_react_hooks we have a blink-mode? that we assign and then check i na transition:
(transition {:cond (fn [_ {:keys [blink-mode?]}]
(boolean blink-mode?))
:event :timeout
:target :state/black})
I'm still getting a graps of statecharts but in the standard they describe the use of an "In" predicate with parallel states for the microwave exemple: https://www.w3.org/TR/scxml/#N11619
Is there an equivalent to that In predicate in fulcr statecharts?found it:
(def In
"[env state-id]
Alias for `is-in-state?`"
is-in-state?)