mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 09:28:31 +00:00
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:
parent
124f94ca6b
commit
fa302c0bb0
2 changed files with 19 additions and 1 deletions
|
|
@ -36,6 +36,17 @@ export const AppVersionsManager = function AppVersionsManager({
|
||||||
// eslint-disable-next-line react-hooks/exhaustive-deps
|
// 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);
|
const wrapperRef = useRef(null);
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
const handleClickOutside = (event) => {
|
const handleClickOutside = (event) => {
|
||||||
|
|
|
||||||
|
|
@ -827,7 +827,14 @@ class Editor extends React.Component {
|
||||||
} else if (!isEmpty(this.state.editingVersion)) {
|
} else if (!isEmpty(this.state.editingVersion)) {
|
||||||
this.setState({ isSavingEditingVersion: true, showSaveDetail: true });
|
this.setState({ isSavingEditingVersion: true, showSaveDetail: true });
|
||||||
appVersionService.save(this.state.appId, this.state.editingVersion.id, this.state.appDefinition).then(() => {
|
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);
|
setTimeout(() => this.setState({ showSaveDetail: false }), 3000);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue