diff --git a/frontend/src/Editor/Container.jsx b/frontend/src/Editor/Container.jsx index a96d4fccad..ecaa0fcef5 100644 --- a/frontend/src/Editor/Container.jsx +++ b/frontend/src/Editor/Container.jsx @@ -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, diff --git a/frontend/src/Editor/EditorFunc.jsx b/frontend/src/Editor/EditorFunc.jsx index df2b71a7e6..39ecc0bb99 100644 --- a/frontend/src/Editor/EditorFunc.jsx +++ b/frontend/src/Editor/EditorFunc.jsx @@ -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'; diff --git a/frontend/src/_stores/utils.js b/frontend/src/_stores/utils.js index 14ffcbac15..fafaa46cd2 100644 --- a/frontend/src/_stores/utils.js +++ b/frontend/src/_stores/utils.js @@ -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; diff --git a/server/migrations/1691006952074-CreateComponentTable.ts b/server/migrations/1691006952074-CreateComponentTable.ts index f0cba1e7a9..88ba29aca7 100644 --- a/server/migrations/1691006952074-CreateComponentTable.ts +++ b/server/migrations/1691006952074-CreateComponentTable.ts @@ -29,7 +29,7 @@ export class CreateComponentTable1691006952074 implements MigrationInterface { }, { name: 'parent', - type: 'uuid', + type: 'varchar', isNullable: true, }, {