Is possible to have an "event interceptor"? #5450
Unanswered
predofrazao
asked this question in
Q&A
Replies: 1 comment 2 replies
-
I'm not sure I fully understand your requirements 🤔 When transitioning to |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'm creating a machine that constantly receives frames at
FRAMES_RECEIVEDevent and I have four states:detecting,validating,processing,done.detectingandvalidatingtakes the frame and assign values, based on custom logic, to context, that I use in other events.The "problem" is that these validations refer to the frame received in that moment. When the machine reaches a new state, it will have already another frame that needs to go through these validations to proceed; otherwise the flow must be restarted.
It would be nice if I could create an interceptor for this event that perform these validations before reaching the handler of the state, then I could redirect the machine to the initial state based on certain condition.
This is my first time working with FSM and XState, and although I've been studying it all week, I'm not sure if this idea makes sense for an FSM, but I'm really enjoying XState and would appreciate some help with it.
Thanks in advance.
Beta Was this translation helpful? Give feedback.
All reactions