From f27078bd34ee72816c673719c8d8f5cb785d2a71 Mon Sep 17 00:00:00 2001 From: Maximilian Giller <m.giller@tu-bs.de> Date: Sun, 28 Aug 2022 18:40:18 +0200 Subject: [PATCH] Improves handling of selected node on changes --- src/editor/js/components/editor.tsx | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/editor/js/components/editor.tsx b/src/editor/js/components/editor.tsx index 5ae9121..eb0e9cd 100644 --- a/src/editor/js/components/editor.tsx +++ b/src/editor/js/components/editor.tsx @@ -179,7 +179,13 @@ export class Editor extends React.PureComponent<propTypes, stateTypes> { * Propagates the changed state of the graph. */ private onHistoryChange() { - this.selectNode(undefined); + if (this.state.selectedNode === undefined) { + this.selectNode(undefined); + } else { + this.selectNode( + this.state.graph.getNode(this.state.selectedNode.id) + ); + } this.forceUpdate(); } -- GitLab