Skip to content
Discussion options

You must be logged in to vote

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

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!
      }
    }
  },

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
1 reply
@teux
Comment options

Comment options

You must be logged in to vote
2 replies
@teux
Comment options

@Andarist
Comment options

Answer selected by teux
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
None yet
3 participants