fulcro

Yab Mas 2025-07-04T09:33:02.041759Z

Pretty new to statecharts, have been doing some experiments to better understand the primitives I have available. When invoking sub-charts I noticed done-data doesnt seem to be passed back up to the parent after completion. As far as I understand the spec this should be the case. When I apply the below patch it does work as expected. Is this a missing piece of the lib or me not understanding the spec/mis-applying it? https://github.com/fulcrologic/statecharts/compare/main...YabMas:statecharts:fix-invoke-done-data

Yab Mas 2025-07-04T09:35:33.993329Z

for context; this is the code i was running in my exploration. so without the patch I'm not getting back the done-data in the parent-chart.

tony.kay 2025-07-04T18:08:16.819659Z

yeah, invoke is a bit under-tested/utilized at the moment. In my spare time (hah) I’ve been trying to make that a little better. Don’t remember if I have any unreleased patches, but I seem to remember running into the same thing

tony.kay 2025-07-04T18:09:02.020399Z

I think I was also surprised that the SCXML spec doesn’t return done-data in all of the cases I would expect.

tony.kay 2025-07-04T19:00:58.387709Z

I did some work on invoke in v 1.2.16…you running that?

Yab Mas 2025-07-05T08:55:38.991709Z

yes i am/was on latest

Yab Mas 2025-07-05T09:01:06.137089Z

In the spec under 5.5, i see: In cases where the SCXML Processor generates a 'done' event upon entry into the final state, it _MUST_ evaluate the <donedata> elements <param> or <content> children and place the resulting data in the _event.data field. My patch is for the send-done-event! function, which wasn't doing anything like that before, that's why I thought it might be a gap in the lib. But I've only really looked at the spec for details like this, didnt read it all nor do I feel like I fully comprehend statecharts in general yet; so its hard for me to judge in light of the full picture.

Yab Mas 2025-07-05T09:02:43.741189Z

This behaviour does make sense for me personally though, for what's it worth 🙂

Yab Mas 2025-07-05T09:11:48.496369Z

When you say "invoke is a bit under-tested/utilized at the moment", you must mean you're not using it a lot yourself either, right? Asking because one of the reasons for me to explore this, is that some of our statecharts are starting to get a bit big/hard to follow and Im looking for ways to better structure them. Breaking them apart into separate statecharts that can invoke one another seemed like a reasonable direction to explore, but you saying you're not using it much makes me wonder if it might not be the best way forward. An obivous alternative strategy would of course be to break-out recurring or logically stand-alone pieces into simple def's for those states, but still compose them into a single statechart. That's kind of what we've been doing, but as said, is still getting out of hand in certain places; although that doesnt have to mean there's anything wrong with that basic strategy and might just mean that we need to improve in how we break them up and define the dependencies/communication etc. Any insight appreaciated.

tony.kay 2025-07-05T15:10:01.608169Z

Oh I plan to use them heavily, I’ve just been swamped with my main business. If you look at recent additions to the library I’m working on a routing system for Fulcro that leverages them extensively so you can co-locate statecharts with UI components.

👍 1
tony.kay 2025-07-05T15:10:30.551439Z

let me read over your patch, it sounds like you’re right

Yab Mas 2025-07-05T15:30:17.315499Z

"patch" is a bit of a big word in this case, there was barely anything extra needed to get it to work, but sure have a look if it makes sense in relation to the rest of the implementation, couldnt realy judge that; but from the spec, function-name and what I understand of the flow this made sense to me

tony.kay 2025-07-05T15:35:12.119339Z

Released in 1.2.7

🙌 1