Fire off "Cancel" modelingMachine event before unmount (#2520)
Co-authored-by: Jess Frazelle <jessfraz@users.noreply.github.com>
This commit is contained in:
@ -637,6 +637,12 @@ export const ModelingMachineProvider = ({
|
|||||||
kclManager.registerExecuteCallback(() => {
|
kclManager.registerExecuteCallback(() => {
|
||||||
modelingSend({ type: 'Re-execute' })
|
modelingSend({ type: 'Re-execute' })
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// Before this component unmounts, call the 'Cancel'
|
||||||
|
// event to clean up any state in the modeling machine.
|
||||||
|
return () => {
|
||||||
|
modelingSend({ type: 'Cancel' })
|
||||||
|
}
|
||||||
}, [modelingSend])
|
}, [modelingSend])
|
||||||
|
|
||||||
// Give the state back to the editorManager.
|
// Give the state back to the editorManager.
|
||||||
@ -659,6 +665,10 @@ export const ModelingMachineProvider = ({
|
|||||||
actor: modelingActor,
|
actor: modelingActor,
|
||||||
commandBarConfig: modelingMachineConfig,
|
commandBarConfig: modelingMachineConfig,
|
||||||
allCommandsRequireNetwork: true,
|
allCommandsRequireNetwork: true,
|
||||||
|
// TODO for when sketch tools are in the toolbar: This was added when we used one "Cancel" event,
|
||||||
|
// but we need to support "SketchCancel" and basically
|
||||||
|
// make this function take the actor or state so it
|
||||||
|
// can call the correct event.
|
||||||
onCancel: () => modelingSend({ type: 'Cancel' }),
|
onCancel: () => modelingSend({ type: 'Cancel' }),
|
||||||
})
|
})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user