From 85a440d8a4c497df45b79c5059edd82a920f038a Mon Sep 17 00:00:00 2001 From: Lukas Mertens Date: Fri, 12 Apr 2024 11:17:51 +0200 Subject: [PATCH] fix(stage): only cache module nodes if they contain children Otherwise caching will result in an error, so we skip it in cases where no children are present. Closes #84 Signed-off-by: Lukas Mertens commit-id:30c12ec7 --- src/modules/evconf_konva/views/module.ts | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/modules/evconf_konva/views/module.ts b/src/modules/evconf_konva/views/module.ts index f09676e9..cb33d1cd 100644 --- a/src/modules/evconf_konva/views/module.ts +++ b/src/modules/evconf_konva/views/module.ts @@ -228,10 +228,14 @@ export default class ModuleView { ev.normal.forEach((id) => { this._terminal_views[id].set_appearence("NORMAL"); }); - this.group.cache(); + if (this.group.children.length > 0) { + this.group.cache(); + } } else if (ev.type === "MODULE_MODEL_UPDATE") { this._title.setText(this._vm.id); - this.group.cache(); + if (this.group.children.length > 0) { + this.group.cache(); + } } } @@ -315,7 +319,9 @@ export default class ModuleView { const end_align = this._vm.terminal_lookup[view.terminal_id].alignment; this._recalculate_terminal_position(end_align, this._vm.terminal_dist[end_align]); - this.group.cache(); + if (this.group.children.length > 0) { + this.group.cache(); + } } _recalculate_terminal_position(alignment: TerminalAlignment, terminal_ids: number[], animate = false) {