Skip to content

Commit

Permalink
update state machine config
Browse files Browse the repository at this point in the history
  • Loading branch information
bfauble committed Jan 23, 2025
1 parent b8af669 commit 360cef9
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion assets/src/components/detours/diversionPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ export const DiversionPage = ({

{snapshot.matches({
"Detour Drawing": {
"Share Detour": { Deleting: "Confirming" },
"Share Detour": "Deleting",
},
}) ? (
<DeleteDetourModal
Expand Down
46 changes: 23 additions & 23 deletions assets/src/models/createDetourMachine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,22 @@ export const createDetourMachine = setup({
finishedDetour: undefined,
detourShape: undefined,
}),
"detour.deleted": assign(() => ({})),
"detour.deleted": assign({
uuid: undefined,
route: undefined,
routePattern: undefined,
routePatterns: undefined,
waypoints: [],
startPoint: undefined,
endPoint: undefined,
nearestIntersection: undefined,
detourShape: undefined,
finishedDetour: undefined,
editedDirections: undefined,
selectedDuration: undefined,
selectedReason: undefined,
activatedAt: undefined,
}),
},
}).createMachine({
id: "Detours Machine",
Expand Down Expand Up @@ -648,37 +663,22 @@ export const createDetourMachine = setup({
},
},
Deleting: {
initial: "Confirming",
on: {
"detour.delete.delete-modal.cancel": {
target: "Reviewing",
},
},
states: {
Confirming: {
on: {
"detour.delete.delete-modal.delete-draft": {
tags: "no-save",
target: "Deleted",
actions: "detour.deleted",
},
},
},
Deleted: {
"detour.delete.delete-modal.delete-draft": {
tags: "no-save",
target: ".onDone",
target: "Deleted",
actions: "detour.deleted",
},
Done: { tags: "no-save", type: "final" },
},
onDone: {
target: "DoneNoSave",
},
},
Deleted: {
target: "Done",
tags: "no-save",
},
Done: { type: "final" },
DoneNoSave: { tags: "no-save", type: "final" },
},
onDone: {
target: "Active",
},
},
Active: {
Expand Down

0 comments on commit 360cef9

Please sign in to comment.