Skip to content

Instantly share code, notes, and snippets.

@zaydek
Created September 19, 2020 20:16
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 zaydek/67a25793238aac6aa8c9f876c2670e99 to your computer and use it in GitHub Desktop.
Save zaydek/67a25793238aac6aa8c9f876c2670e99 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
const delayedTransientRefetchForeverMachine = Machine({
id: "delayedTransientRefetchForever",
initial: "fetching",
states: {
fetching: {
invoke: {
id: "fetchHandler",
src: (ctx, e) => new Promise((resolve, reject) => {
setTimeout(() => {
reject()
}, 1e3)
}),
onDone: "success",
onError: "failure",
},
},
failure: {
after: {
1e3: "fetching",
}
},
success: {
type: "final",
},
},
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment