Skip to content

Instantly share code, notes, and snippets.

@tomByrer
Created January 16, 2021 19:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tomByrer/f1a44a49f56811adc3cdf67aa9d067b2 to your computer and use it in GitHub Desktop.
Save tomByrer/f1a44a49f56811adc3cdf67aa9d067b2 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Master machine for radio buttons
const inputGroupMachine = Machine({
id: 'input-group',
initial: 'emptied',
states: {
emptied: {
on: {
FETCH: 'pending',
}
},
pending: {
on: {
REJECT: 'failure',
FULFILL: 'distributing',
}
},
failure: {
on: {
RETRY: 'pending',
}
},
distributing: { // indivudal items array
on: {
COMPLETE: 'selectable',
// REJECT: 'failure',
}
},
selectable: {
initial: 'empty',
states: {
empty: {
on: {
'FILL': 'full',
}
},
full: {
on: {
FILL: 'full', // EMPTY old item
SUBMIT: 'submitting',
// SELECT: 'sending'
}
},
submitting: {
on: {
COMPLETE: '#clear-old'
}
},
}
},
clearing: {
id: 'clear-old',
on: {
DONE: 'emptied'
}
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment