fulcro

roklenarcic 2026-03-15T14:21:28.464369Z

If I don’t have a hooks component, how would I make some kind of process that gets stopped when component is unmounted (e.g. like use-effect does). For instance I start a statechart but I want to signal that statechart to stop when unmounted.

tony.kay 2026-03-15T17:01:22.502869Z

From my perspective this is best done by the logic, which is why I like statecharts. on-exit. Done. In older systems, I’d recommend doing so in the routing system (dynamic routing has hooks for that).

tony.kay 2026-03-15T17:02:33.409759Z

what is on screen should be up to your logic. Fulcro renders your data tree. You change the data tree, the ui changes. Therefore, changing the data tree via mutations, UISM, statecharts, etc. should be the process whereby you control ALL side effects.

tony.kay 2026-03-15T17:03:03.191889Z

Tying process to UI rendering is a terrible idea in all cases except those that need to manipulate/access the DOM

tony.kay 2026-03-15T17:03:54.099349Z

E.g. I use use-effect in my statechart visualizer because I need to measure the DOM nodes being laid out, and use an async js call to compute results based on those sizes…there’s nothing in my logic that can be done outside of this DOM concern…it’s a DOM layout problem.

tony.kay 2026-03-15T17:05:19.374959Z

But yeah, overall this is why I’m trying to rebuild a UI routing layer in statecharts, so that these kinds of process concerns can be cleanly structured into on-entry/on-exit executable content of the states that also happen to change the state so that certain things appear on the screen.

roklenarcic 2026-03-15T17:55:48.709169Z

Thanks

roklenarcic 2026-03-15T22:42:15.507629Z

If I don’t user autoforward flag in my statechart invocation, how do I forward events across? A bunch of transitions in the parent chart that have Send element to pass the event?

tony.kay 2026-03-16T00:30:40.922649Z

correct…if you’re using invocations you can either autoforward all events, or send events to it some other way (send nodes or use the external event queue from within script elements). Of course you can also send it events from external code via the event queue as well

tony.kay 2026-03-16T00:31:22.502949Z

Autoforward seems the logical choice in most cases because you’ll be in the state that started the invocation…so you’ll only be forwarding them when that is active.