[Bugfix] On dispatching Undo ⌘Z or Redo ⌘+shift+Z actions to a component on the editor should also update the internal state or props for the children. (#2826)

* fixes currentState should receive updates on appDefinations gets a new update [undo]

* update the internal state or props for the children.
This commit is contained in:
Arpit 2022-04-16 06:50:46 +05:30 committed by GitHub
parent 18ee640496
commit 175820ea31
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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();
});
};