From f06916940c442ce9b1f08cf3cdea108b759c1ede Mon Sep 17 00:00:00 2001 From: arpitnath Date: Mon, 25 Sep 2023 01:15:47 +0530 Subject: [PATCH] fixes: redo breaks- on deleting a component and undo then redo (editor) --- frontend/src/Editor/EditorFunc.jsx | 2 +- frontend/src/_helpers/appUtils.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/frontend/src/Editor/EditorFunc.jsx b/frontend/src/Editor/EditorFunc.jsx index 24a8b2befe..4ca939fcce 100644 --- a/frontend/src/Editor/EditorFunc.jsx +++ b/frontend/src/Editor/EditorFunc.jsx @@ -908,7 +908,7 @@ const EditorComponent = (props) => { const updatedAppDefinition = JSON.parse(JSON.stringify(appDefinition)); handlePaths(patchesToRedo[0]?.value, [...patchesToRedo[0].path], updatedAppDefinition); - + removeUndefined(updatedAppDefinition); const _diffPatches = diff(updatedAppDefinition, appDefinition); const redoDiff = diff(appDefinition, updatedAppDefinition); updateAppDefinitionDiff(redoDiff); diff --git a/frontend/src/_helpers/appUtils.js b/frontend/src/_helpers/appUtils.js index 33c6a4263b..0a516b6225 100644 --- a/frontend/src/_helpers/appUtils.js +++ b/frontend/src/_helpers/appUtils.js @@ -1159,6 +1159,8 @@ export function computeComponentState(components = {}) { const currentComponents = getCurrentState().components; Object.keys(components).forEach((key) => { + if (!components[key]) return; + const { component } = components[key]; const componentMeta = componentTypes.find((comp) => component.component === comp.component);