Created
March 19, 2020 23:21
-
-
Save hnordt/94f64f1457d46c5c55039c12eff8bbfd 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
Machine({ | |
id: 'collections', | |
initial: 'fetching', | |
context: { | |
}, | |
states: { | |
fetching: { | |
initial: "pending", | |
states: { | |
pending: { | |
invoke: { | |
src: "fetchCollections", | |
onDone: "success", | |
onError: "failure" | |
} | |
}, | |
success: { | |
entry: "setCollections", | |
initial: "idle", | |
states: { | |
fetchingPolicies: { | |
initial: "pending", | |
states: { | |
pending: { | |
invoke: { | |
src: "fetchPolicies", | |
onDone: "success", | |
onError: "failure" | |
} | |
}, | |
success: { | |
entry: "setPolicies", | |
type: "final" | |
}, | |
failure: { | |
entry: "setError", | |
exit: "resetError", | |
on: { | |
RETRY: "pending" | |
} | |
} | |
}, | |
onDone: "fetchingBlockPages" | |
}, | |
fetchingBlockPages: { | |
initial: "pending", | |
states: { | |
pending: { | |
invoke: { | |
src: "fetchBlockPages", | |
onDone: "success", | |
onError: "failure" | |
} | |
}, | |
success: { | |
entry: "setBlockPages", | |
type: "final" | |
}, | |
failure: { | |
entry: "setError", | |
exit: "resetError", | |
on: { | |
RETRY: "pending" | |
} | |
} | |
}, | |
onDone: "idle" | |
}, | |
idle: { | |
on: { | |
UPDATE_POLICY: "updatingPolicy", | |
UPDATE_BLOCK_PAGE: "updatingBlockPage", | |
DELETE_COLLECTION: "deletingCollection" | |
} | |
}, | |
updatingPolicy: { | |
entry: "setPolicyId", | |
exit: "resetPolicyId", | |
initial: "pending", | |
states: { | |
pending: { | |
invoke: { | |
src: "updateCollection", | |
onDone: "success", | |
onError: "failure" | |
}, | |
on: { | |
CANCEL: undefined | |
} | |
}, | |
success: { | |
entry: "setCollection" | |
}, | |
failure: { | |
entry: "setError", | |
exit: "resetError", | |
on: { | |
RETRY: "pending" | |
} | |
} | |
}, | |
on: { | |
CANCEL: "idle" | |
} | |
}, | |
updatingBlockPage: { | |
entry: "setBlockPageId", | |
exit: "resetBlockPageId", | |
initial: "pending", | |
states: { | |
pending: { | |
invoke: { | |
src: "updateCollection", | |
onDone: "success", | |
onError: "failure" | |
}, | |
on: { | |
CANCEL: undefined | |
} | |
}, | |
success: { | |
entry: "setCollection" | |
}, | |
failure: { | |
entry: "setError", | |
exit: "resetError", | |
on: { | |
RETRY: "pending" | |
} | |
} | |
}, | |
on: { | |
CANCEL: "idle" | |
} | |
}, | |
deletingCollection: { | |
entry: "setCollectionId", | |
exit: "resetCollectionId", | |
initial: "pending", | |
states: { | |
pending: { | |
invoke: { | |
src: "deleteCollection", | |
onDone: "success", | |
onError: "failure" | |
}, | |
on: { | |
CANCEL: undefined | |
} | |
}, | |
success: { | |
entry: "removeCollection" | |
}, | |
failure: { | |
entry: "setError", | |
exit: "resetError", | |
on: { | |
RETRY: "pending" | |
} | |
} | |
}, | |
on: { | |
CANCEL: "idle" | |
} | |
}, | |
}, | |
on: { | |
SEARCH: { | |
target: "pending", | |
actions: "setQuery" | |
} | |
} | |
}, | |
failure: { | |
entry: "setError", | |
exit: "resetError", | |
on: { | |
RETRY: "pending" | |
} | |
} | |
}, | |
on: { | |
EDIT: { | |
target: "editing", | |
actions: "setCollectionId" | |
} | |
} | |
}, | |
editing: { | |
initial: "pending", | |
states: { | |
pending: { | |
invoke: { | |
src: "fetchCollection", | |
onDone: "success", | |
onError: "failure" | |
} | |
}, | |
success: { | |
entry: "setCollection" | |
}, | |
failure: { | |
entry: "setError", | |
exit: "resetError", | |
on: { | |
RETRY: "pending" | |
} | |
} | |
}, | |
on: { | |
CANCEL: "fetching" | |
} | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment