Skip to content
Discussion options

You must be logged in to vote

Yes there is, but you have to change the way you think about modeling the logic here. You essentially want two things to happen at the same time:

  • An action to be executed on every transition
  • Normal transitions between states to happen

These seem like orthogonal concerns. So what should you use? Orthogonal (a.k.a. parallel) state nodes!

{
  type: 'parallel',
  states: {
    whatever: {
      on: { '*': { actions: 'doSomething' } }
    },
    editor: {
      initial: 'loading',
      states: {
        loading: {/* ... */},
        // ...
      }
    }
  }
}

Replies: 2 comments 2 replies

Comment options

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

Comment options

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

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