Closed tkolanko closed 4 years ago
yarn run pretty
Element events can potentially be null if they trigger a dialog to appear when clicked Fixes #665
When you close a dialog created by clicking an element and go to interact with the canvas this event will fire: https://github.com/projectstorm/react-diagrams/blob/ce38f77027ac37ca9193c6faccc6049036906e42/packages/react-canvas-core/src/states/MoveItemsState.ts#L24-L25 which calls https://github.com/projectstorm/react-diagrams/blob/655462087f1f54eccb5e75f024be00efda674eab/packages/react-canvas-core/src/core-actions/ActionEventBus.ts#L41-L46 which checks if a model exists and if it doesn't it will return https://github.com/projectstorm/react-diagrams/blob/655462087f1f54eccb5e75f024be00efda674eab/packages/react-canvas-core/src/CanvasEngine.ts#L178-L180 which returns null
Added an early return if the element is null
Checklist
yarn run pretty
What?
Element events can potentially be null if they trigger a dialog to appear when clicked Fixes #665
Why?
When you close a dialog created by clicking an element and go to interact with the canvas this event will fire: https://github.com/projectstorm/react-diagrams/blob/ce38f77027ac37ca9193c6faccc6049036906e42/packages/react-canvas-core/src/states/MoveItemsState.ts#L24-L25 which calls https://github.com/projectstorm/react-diagrams/blob/655462087f1f54eccb5e75f024be00efda674eab/packages/react-canvas-core/src/core-actions/ActionEventBus.ts#L41-L46 which checks if a model exists and if it doesn't it will return https://github.com/projectstorm/react-diagrams/blob/655462087f1f54eccb5e75f024be00efda674eab/packages/react-canvas-core/src/CanvasEngine.ts#L178-L180 which returns null
How?
Added an early return if the element is null
Feel good image: