Skip to content

Instantly share code, notes, and snippets.

@cellog
Last active April 10, 2020 15:49
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 cellog/19c2a2007a17f7f02c3d407aa8d5900c to your computer and use it in GitHub Desktop.
Save cellog/19c2a2007a17f7f02c3d407aa8d5900c to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
// Available variables:
// - Machine
// - interpret
// - assign
// - send
// - sendParent
// - spawn
// - raise
// - actions
// - XState (all XState exports)
const dataObjectsMachine = Machine({
id: 'data objects machine',
initial: 'table',
context: {
pageData: [],
page: 0,
totalRecords: 0,
errorMessage: "",
},
states: {
table: {
on: {
CLEAR: {
actions: [
send("CLEAR", { to: "edit filter"})
]
},
EDIT: {
actions: [
send("EDIT", { to: "edit filter" })
]
},
PAGE_LOADED: {
actions: assign((_, newContext) => newContext)
},
ERROR: {
actions: assign({
errorMessage: (_, { errorMessage }) => errorMessage
})
}
}
}
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment