0

XState newbie here. Apologies if this is a very basic question.

I'm attempting to model a workflow containing multiple steps each with its own set of states, and I'd like the parent workflow to have states that mirror the child records. Something like this:

| PurchaseOrderRequest | PurchaseOrder | WorkOrder | Workflow        
| draft                |               |           | request drafted  
| submitted            |               |           | request submitted 
| approved             |               |           | request approved
|                      | ordered       |           | ordered with vendor
|                      | confirmed     |           | confirmed with vendor
|                      | received      |           | received

There will be more sub-records than that, but you get the idea. The Workflow parent object needs to have a state that reflects each state in each child workflow. I don't actually want the Workflow machine to have its own transitions; I want all transitions to be triggered by the children and then to update the parent accordingly. I believe I can do that part with callbacks, but I'm not clear on how to model the parent/child relationship.

How can I model this in XState?

kid_drew
  • 3,857
  • 6
  • 28
  • 38

0 Answers0