Created
September 19, 2020 19:58
-
-
Save zaydek/38803af4128169b2a0c043fd048d741f 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 naiveRefetchForeverMachine = Machine({ | |
id: "naiveRefetchForever", | |
initial: "fetching", | |
states: { | |
fetching: { | |
invoke: { | |
id: "fetchHandler", | |
src: (ctx, e) => new Promise((resolve, reject) => { | |
setTimeout(() => { | |
// if (Math.random() < 0.5) { | |
reject() | |
// } else { | |
// resolve() | |
// } | |
}, 1e3) | |
}), | |
onDone: "success", | |
onError: "fetching", | |
}, | |
}, | |
success: { | |
type: "final", | |
}, | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment