mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-23 17:08:34 +00:00
Reset selected component state to null when a component is deleted (#258)
This commit is contained in:
parent
582ac71973
commit
a2b89ffe25
1 changed files with 11 additions and 1 deletions
|
|
@ -230,6 +230,16 @@ class Editor extends React.Component {
|
|||
this.computeComponentState(newDefinition.components);
|
||||
};
|
||||
|
||||
handleInspectorView = (component) => {
|
||||
if (this.state.selectedComponent.hasOwnProperty('component')) {
|
||||
const { id: selectedComponentId } = this.state.selectedComponent;
|
||||
if (selectedComponentId === component.id) {
|
||||
this.setState({selectedComponent: null})
|
||||
this.switchSidebarTab(2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
removeComponent = (component) => {
|
||||
let newDefinition = this.state.appDefinition;
|
||||
|
||||
|
|
@ -241,7 +251,7 @@ class Editor extends React.Component {
|
|||
|
||||
delete newDefinition.components[component.id];
|
||||
this.appDefinitionChanged(newDefinition);
|
||||
this.switchSidebarTab(2);
|
||||
this.handleInspectorView(component);
|
||||
};
|
||||
|
||||
componentDefinitionChanged = (newDefinition) => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue