Parallel state machine #2181
-
Beta Was this translation helpful? Give feedback.
Answered by
davidkpiano
May 9, 2021
Replies: 2 comments 3 replies
-
|
Great diagrams! Can you make a reproducible CodeSandbox example for this? |
Beta Was this translation helpful? Give feedback.
1 reply
-
|
So this is one of the awkward parts about SCXML: you can only specify "done data" (the export default createMachine<Context>(
{
id: "parallelMachine",
context: {
results: []
},
initial: "tasks",
states: {
tasks: {
type: "parallel",
states: {
...parallelStates
},
onDone: {
target: "success"
}
},
success: {
type: "final",
data: (ctx) => ctx.results // << this works!
}
}
},
{ ...machineOptions }
); |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
teux
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment


So this is one of the awkward parts about SCXML: you can only specify "done data" (the
dataproperty) on<final>states. However, you're doing the right thing by assigning that data tocontextfor use later. If you modify your machine to have a final state, it works as expected: