hotfix: Edited changes not shown when switching versions (#2386)

* fix edited changes not shown when switching versions

* fix version create from not picking editing version

* fix version switch not updated on editing version save
This commit is contained in:
Akshay 2022-03-15 13:02:45 +05:30 committed by GitHub
parent 124f94ca6b
commit fa302c0bb0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 19 additions and 1 deletions

View file

@ -36,6 +36,17 @@ export const AppVersionsManager = function AppVersionsManager({
// eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
useEffect(() => {
setEditingAppVersion(editingVersion);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [editingVersion]);
useEffect(() => {
appVersions[appVersions.findIndex((appVersion) => appVersion.id === editingVersion.id)] = editingAppVersion;
setCreateAppVersionFrom(editingAppVersion);
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [editingAppVersion]);
const wrapperRef = useRef(null);
useEffect(() => {
const handleClickOutside = (event) => {

View file

@ -827,7 +827,14 @@ class Editor extends React.Component {
} else if (!isEmpty(this.state.editingVersion)) {
this.setState({ isSavingEditingVersion: true, showSaveDetail: true });
appVersionService.save(this.state.appId, this.state.editingVersion.id, this.state.appDefinition).then(() => {
this.setState({ isSavingEditingVersion: false });
this.setState({
isSavingEditingVersion: false,
editingVersion: {
...this.state.editingVersion,
...{ definition: this.state.appDefinition },
},
});
setTimeout(() => this.setState({ showSaveDetail: false }), 3000);
});
}