Canvas: Fix inline edit toggle crash (#55961)

This commit is contained in:
Nathan Marrs 2022-09-28 15:31:30 -07:00 committed by GitHub
parent b0cd511ecc
commit 5a9dfd7173
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 5 deletions

View File

@ -168,15 +168,16 @@ export class CanvasPanel extends Component<Props, State> {
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;

View File

@ -32,7 +32,7 @@ export function getLayerEditor(opts: InstanceState): NestedPanelOptions<LayerEdi
break;
}
if (element.parent) {
if (element && element.parent) {
scene.currentLayer = element.parent;
break;
}