fixes: tabs default children saving

This commit is contained in:
arpitnath 2023-09-18 21:52:20 +05:30
parent c74f075863
commit 1378166630
4 changed files with 8 additions and 5 deletions

View file

@ -194,7 +194,6 @@ export const Container = ({
if (componendAdded) {
opts.componentAdded = true;
}
appDefinitionChanged(newDefinition, opts);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [boxes]);
@ -522,8 +521,8 @@ export const Container = ({
const componentWithChildren = {};
Object.keys(components).forEach((key) => {
const component = components[key];
const { parent } = component;
if (parent) {
if (component?.parent) {
componentWithChildren[parent] = {
...componentWithChildren[parent],
[key]: component,

View file

@ -61,7 +61,6 @@ import { shallow } from 'zustand/shallow';
import { useEditorActions, useEditorState, useEditorStore } from '@/_stores/editorStore';
import { useAppDataActions, useAppInfo } from '@/_stores/appDataStore';
import { useMounted } from '@/_hooks/use-mount';
// eslint-disable-next-line import/no-unresolved
import { diff } from 'deep-object-diff';

View file

@ -223,9 +223,14 @@ const computeComponentDiff = (appDiff, currentPageId, opts) => {
});
}
if (result[id]?.definition) {
delete result[id].definition;
}
result[id].type = componentMeta.component;
result[id].parent = component.component.parent ?? null;
result[id].layouts = appDiff.pages[currentPageId].components[id].layouts;
operation = 'create';
return result;

View file

@ -29,7 +29,7 @@ export class CreateComponentTable1691006952074 implements MigrationInterface {
},
{
name: 'parent',
type: 'uuid',
type: 'varchar',
isNullable: true,
},
{