Skip to content

Instantly share code, notes, and snippets.

@hnordt
Last active March 25, 2020 01:04
Show Gist options
  • Save hnordt/53700cc7f69dfe7edc3bbe9666746647 to your computer and use it in GitHub Desktop.
Save hnordt/53700cc7f69dfe7edc3bbe9666746647 to your computer and use it in GitHub Desktop.
Generated by XState Viz: https://xstate.js.org/viz
Machine({
id: 'collections',
initial: 'fetching',
states: {
fetching: {
invoke: {
src: "fetchCollections",
onDone: "success",
onError: "failure"
}
},
success: {
on: {
SEARCH: 'fetching'
}
},
failure: {
on: {
RETRY: 'fetching'
}
}
}
});
// Machine({
// id: 'collection',
// initial: 'idle',
// states: {
// idle: {
// on: {
// EDIT: "refetching",
// QUICK_EDIT: "quickEditing",
// DELETE: "deleting"
// }
// },
// refetching: {
// initial: "pending",
// states: {
// pending: {
// invoke: {
// src: "fetchCollection",
// onDone: "success",
// onError: "failure"
// }
// },
// success: {
// type: "final"
// },
// failure: {
// on: {
// RETRY: 'pending'
// }
// }
// },
// onDone: "editing"
// },
// quickEditing: {
// initial: "idle",
// states: {
// idle: {
// on: {
// SUBMIT: "pending"
// }
// },
// pending: {
// invoke: {
// src: "updateCollection",
// onDone: "success",
// onError: "failure"
// }
// },
// success: {
// type: "final"
// },
// failure: {
// on: {
// RETRY: 'pending'
// }
// }
// },
// on: {
// CANCEL: "idle"
// },
// onDone: "idle"
// },
// editing: {
// initial: "fetchingUsers",
// states: {
// fetchingUsers: {
// initial: "pending",
// states: {
// pending: {
// invoke: {
// src: "fetchUsers",
// onDone: "success",
// onError: "failure"
// }
// },
// success: {
// entry: "spawnUsers",
// type: "final"
// },
// failure: {
// on: {
// RETRY: 'pending'
// }
// }
// },
// onDone: "ready"
// },
// ready: {
// initial: "idle",
// states: {
// idle: {
// on: {
// SUBMIT: "pending"
// }
// },
// pending: {
// invoke: {
// src: "updateCollection",
// onDone: "success",
// onError: "failure"
// }
// },
// success: {},
// failure: {
// on: {
// RETRY: 'pending'
// }
// }
// }
// }
// },
// on: {
// CANCEL: "idle"
// }
// },
// reordering: {
// initial: "idle",
// states: {
// idle: {
// on: {
// SUBMIT: "pending"
// }
// },
// pending: {
// invoke: {
// src: "reorderCollection",
// onDone: "success",
// onError: "failure"
// }
// },
// success: {},
// failure: {
// on: {
// RETRY: 'pending'
// }
// }
// },
// on: {
// CANCEL: "idle"
// }
// },
// deleting: {
// initial: "idle",
// states: {
// idle: {
// on: {
// SUBMIT: "pending"
// }
// },
// pending: {
// invoke: {
// src: "deleteCollection",
// onDone: "success",
// onError: "failure"
// }
// },
// success: {},
// failure: {
// on: {
// RETRY: 'pending'
// }
// }
// },
// on: {
// CANCEL: "idle"
// }
// }
// }
// });
// Machine({
// id: 'collectionUser',
// initial: 'idle',
// states: {
// idle: {
// on: {
// SELECT: "assigning",
// DESELECT: "unassigning"
// }
// },
// assigning: {
// initial: "pending",
// states: {
// pending: {
// invoke: {
// src: "assign",
// onDone: "success",
// onError: "failure"
// }
// },
// success: {
// type: "final"
// },
// failure: {
// on: {
// RETRY: 'pending'
// }
// }
// },
// onDone: "idle"
// },
// unassigning: {
// initial: "pending",
// states: {
// pending: {
// invoke: {
// src: "unassign",
// onDone: "success",
// onError: "failure"
// }
// },
// success: {
// type: "final"
// },
// failure: {
// on: {
// RETRY: 'pending'
// }
// }
// },
// onDone: "idle"
// }
// }
// });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment