mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-06 06:48:21 +00:00
Child components should be deleted with parent
This commit is contained in:
parent
3c586ae5a8
commit
da0b190b21
1 changed files with 7 additions and 0 deletions
|
|
@ -221,6 +221,13 @@ class Editor extends React.Component {
|
|||
|
||||
removeComponent = (component) => {
|
||||
let newDefinition = this.state.appDefinition;
|
||||
|
||||
// Delete child components when parent is deleted
|
||||
const childComponents = Object.keys(newDefinition.components).filter((key) => newDefinition.components[key].parent === component.id)
|
||||
childComponents.forEach((componentId) => {
|
||||
delete newDefinition.components[componentId]
|
||||
})
|
||||
|
||||
delete newDefinition.components[component.id];
|
||||
this.appDefinitionChanged(newDefinition);
|
||||
this.switchSidebarTab(2);
|
||||
|
|
|
|||
Loading…
Reference in a new issue