From 9493cdbbbe9d83b6245a2530ae6e8085cc3c3c3c Mon Sep 17 00:00:00 2001 From: arpitnath Date: Sat, 30 Sep 2023 21:19:21 +0530 Subject: [PATCH] fix: calendar subcontainer components comes out of the parent container on copy/paste --- frontend/src/_helpers/appUtils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/_helpers/appUtils.js b/frontend/src/_helpers/appUtils.js index e77ef7f857..4639581ef3 100644 --- a/frontend/src/_helpers/appUtils.js +++ b/frontend/src/_helpers/appUtils.js @@ -1399,7 +1399,6 @@ const getAllChildComponents = (allComponents, parentId) => { if (componentParentId && isParentTabORCalendar) { const childComponent = allComponents[componentId]; const childTabId = componentParentId.split('-').at(-1); - if (componentParentId === `${parentId}-${childTabId}`) { childComponent.componentId = componentId; childComponents.push(childComponent); @@ -1437,7 +1436,7 @@ const updateComponentLayout = (components, parentId, isCut = false) => { }; const isChildOfTabsOrCalendar = (component, allComponents = []) => { - const parentId = component.component.parent.slice(0, -2); + const parentId = component.component.parent.split('-').slice(0, -1).join('-'); const parentComponent = allComponents.find((comp) => comp.componentId === parentId); @@ -1469,8 +1468,9 @@ export const addComponents = (pageId, appDefinition, appDefinitionChanged, paren const componentData = component.component; if (isChild && isChildOfTabsOrCalendar(component, pastedComponents)) { - const parentId = component.component.parent.slice(0, -2); + const parentId = component.component.parent.split('-').slice(0, -1).join('-'); const childTabId = component.component.parent.split('-').at(-1); + componentData.parent = `${componentMap[parentId]}-${childTabId}`; } else if (isChild) { componentData.parent = componentMap[isChild];