From 5a9dfd717307b770cdf5f1535263c1b5fc541b19 Mon Sep 17 00:00:00 2001 From: Nathan Marrs Date: Wed, 28 Sep 2022 15:31:30 -0700 Subject: [PATCH] Canvas: Fix inline edit toggle crash (#55961) --- public/app/plugins/panel/canvas/CanvasPanel.tsx | 9 +++++---- public/app/plugins/panel/canvas/editor/layerEditor.tsx | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/public/app/plugins/panel/canvas/CanvasPanel.tsx b/public/app/plugins/panel/canvas/CanvasPanel.tsx index 298a668c126..06350f379cd 100644 --- a/public/app/plugins/panel/canvas/CanvasPanel.tsx +++ b/public/app/plugins/panel/canvas/CanvasPanel.tsx @@ -168,15 +168,16 @@ export class CanvasPanel extends Component { const shouldShowAdvancedTypesSwitched = this.props.options.showAdvancedTypes !== nextProps.options.showAdvancedTypes; if (shouldUpdateSceneAndPanel || inlineEditingSwitched || shouldShowAdvancedTypesSwitched) { + if (inlineEditingSwitched) { + // Replace scene div to prevent selecto instance leaks + this.scene.revId++; + } + this.needsReload = false; this.scene.load(nextProps.options.root, nextProps.options.inlineEditing, nextProps.options.showAdvancedTypes); this.scene.updateSize(nextProps.width, nextProps.height); this.scene.updateData(nextProps.data); changed = true; - - if (inlineEditingSwitched && this.props.options.inlineEditing) { - this.scene.selecto?.destroy(); - } } return changed; diff --git a/public/app/plugins/panel/canvas/editor/layerEditor.tsx b/public/app/plugins/panel/canvas/editor/layerEditor.tsx index 32858b59511..28cf61c56e8 100644 --- a/public/app/plugins/panel/canvas/editor/layerEditor.tsx +++ b/public/app/plugins/panel/canvas/editor/layerEditor.tsx @@ -32,7 +32,7 @@ export function getLayerEditor(opts: InstanceState): NestedPanelOptions