From 175820ea31f21a1f9da8e3e67f68603590333708 Mon Sep 17 00:00:00 2001 From: Arpit Date: Sat, 16 Apr 2022 06:50:46 +0530 Subject: [PATCH] =?UTF-8?q?[Bugfix]=20On=20dispatching=20Undo=20=E2=8C=98Z?= =?UTF-8?q?=20or=20Redo=20=E2=8C=98+shift+Z=20actions=20to=20a=20component?= =?UTF-8?q?=20on=20the=20editor=20should=20also=20update=20the=20internal?= =?UTF-8?q?=20state=20or=20props=20for=20the=20children.=20(#2826)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fixes currentState should receive updates on appDefinations gets a new update [undo] * update the internal state or props for the children. --- frontend/src/Editor/Editor.jsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/frontend/src/Editor/Editor.jsx b/frontend/src/Editor/Editor.jsx index 636a17c91b..3e67694a5b 100644 --- a/frontend/src/Editor/Editor.jsx +++ b/frontend/src/Editor/Editor.jsx @@ -144,6 +144,12 @@ class Editor extends React.Component { }); } + componentDidUpdate(prevProps, prevState) { + if (prevState.appDefinition !== this.state.appDefinition) { + computeComponentState(this, this.state.appDefinition.components); + } + } + isVersionReleased = (version = this.state.editingVersion) => { if (isEmpty(version)) { return false; @@ -500,6 +506,7 @@ class Editor extends React.Component { this.handleAddPatch ); setStateAsync(_self, newDefinition).then(() => { + computeComponentState(_self, _self.state.appDefinition.components); this.autoSave(); }); };