Last active
April 10, 2020 15:49
-
-
Save cellog/19c2a2007a17f7f02c3d407aa8d5900c to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
This file contains 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
// 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