mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
Fixed issue causing entire subcontainer components to not be undoed/redoed together
This commit is contained in:
parent
b12aecb5ad
commit
dd1620a3bd
1 changed files with 14 additions and 12 deletions
|
|
@ -743,9 +743,12 @@ export const createComponentsSlice = (set, get) => ({
|
|||
deleteComponentNameIdMapping(oldName, moduleId);
|
||||
}
|
||||
updateComponentDependencyGraph(moduleId, newComponent);
|
||||
const parentId = newComponent.component.parent || 'canvas';
|
||||
set(
|
||||
withUndoRedo((state) => {
|
||||
});
|
||||
set(
|
||||
withUndoRedo((state) => {
|
||||
newComponents.forEach((newComponent) => {
|
||||
const parentId = newComponent.component.parent || 'canvas';
|
||||
|
||||
if (!state.containerChildrenMapping[parentId]) {
|
||||
state.containerChildrenMapping[parentId] = [];
|
||||
}
|
||||
|
|
@ -754,15 +757,14 @@ export const createComponentsSlice = (set, get) => ({
|
|||
}
|
||||
const page = state.modules[moduleId].pages[state.currentPageIndex];
|
||||
page.components[newComponent.id] = newComponent;
|
||||
}, skipUndoRedo),
|
||||
false,
|
||||
'addComponentToCurrentPage'
|
||||
);
|
||||
if (index === 0) {
|
||||
//incase of multiple components, only first one will be selected since it will be the parent component
|
||||
get().setSelectedComponents([newComponent.id]);
|
||||
}
|
||||
});
|
||||
});
|
||||
}, skipUndoRedo),
|
||||
false,
|
||||
'addComponentToCurrentPage'
|
||||
);
|
||||
|
||||
//incase of multiple components, only first one will be selected since it will be the parent component
|
||||
get().setSelectedComponents([newComponents[0].id]);
|
||||
|
||||
if (saveAfterAction) {
|
||||
saveComponentChanges(diff, 'components', 'create')
|
||||
|
|
|
|||
Loading…
Reference in a new issue