-
How to get the previous event that targets this state when inside of an action of a state with always eventless transitions?
states: {
stage__online: {
on: {
evx__goOffline: 'stage__offlineCleanup',
},
},
stage__offlineCleanup: {
always: {
target: 'stage__offline',
actions: (context, event, _meta) => {
console.log(event); // << there is nothing inside this event?
// how can I get the previous event `evx__goOffline` that targets this `stage__offlineCleanup`?
// (in GuardMeta, it seems like I can get it through `_meta.state.event.type`? but not for ActionMeta?)
},
},
},
stage__offline: {
type: 'final',
},
}, |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
We just released a new major version of XState. It solves this problem since we removed the notion of null events there. So |
Beta Was this translation helpful? Give feedback.
We just released a new major version of XState. It solves this problem since we removed the notion of null events there. So
actions
in always transitions should be always executed with theevent
that triggered the original transition