Last active
January 3, 2021 06:12
-
-
Save pavankataria/ec0aebf7aab95d8595c2a41beab30a18 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const factoryViewing = Machine({ | |
id: 'factoryViewing', | |
initial: 'idle', | |
states: { | |
idle: { | |
on: { | |
LOAD: 'loading' | |
} | |
}, | |
loading: { | |
on: { | |
SUCCESS: 'interacting', | |
ON_EMPTY: 'empty', | |
DID_ERROR: 'error', | |
} | |
}, | |
// State | |
interacting: { | |
initial: 'idle', | |
states: { | |
// State | |
idle: { | |
on: { | |
HAS_ORDERS: 'factorySelection', | |
NO_ORDERS: 'empty', | |
} | |
}, | |
// State | |
factorySelection: { | |
on: { | |
SELECT_FACTORY: 'specificFactoryView' | |
} | |
}, | |
// State | |
specificFactoryView: { | |
initial: 'idle', | |
on: { | |
UNSELECT_FACTORY: 'factorySelection', | |
SELECT_FACTORY: 'specificFactoryView', | |
}, | |
states: { | |
// State | |
idle: { | |
on: { | |
HAS_DATA: 'orders', | |
NO_DATA: 'dispatchedAll', | |
} | |
}, | |
// State | |
dispatchedAll: {}, | |
orders: { | |
initial: 'noOrdersSelected', | |
states: { | |
noOrdersSelected: { | |
on: { | |
SELECT_ORDER: 'specificOrder', | |
} | |
}, | |
specificOrder: { | |
on: { | |
SELECT_ORDER: 'specificOrder', | |
}}, | |
} | |
}, | |
} | |
}, | |
empty: {}, | |
} | |
}, | |
empty: {}, | |
error: {} | |
}, | |
on: { | |
RELOAD: 'loading' | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment