fixes: on delete version fetchApp fails

This commit is contained in:
arpitnath 2023-10-23 21:18:07 +05:30
parent 908e7dee6c
commit 2a16b341e7
2 changed files with 9 additions and 7 deletions

View file

@ -67,23 +67,25 @@ export const AppVersionsManager = function ({ appId, setAppDefinitionFromVersion
appVersionService
.del(appId, versionId)
.then(() => {
onVersionDelete();
toast.dismiss(deleteingToastId);
toast.success(`Version - ${versionName} Deleted`);
resetDeleteModal();
setGetAppVersionStatus(appVersionLoadingStatus.loading);
appVersionService.getAll(appId).then((data) => {
setAppVersions(data.versions);
});
})
.catch((error) => {
toast.dismiss(deleteingToastId);
toast.error(error?.error ?? 'Oops, something went wrong');
setGetAppVersionStatus(appVersionLoadingStatus.error);
resetDeleteModal();
})
.finally(() => {
appVersionService.getAll(appId, true).then((data) => {
setAppVersions(data.versions);
onVersionDelete();
});
});
};
//this
const options = appVersions.map((appVersion) => ({
value: appVersion.id,
isReleasedVersion: appVersion.id === releasedVersionId,

View file

@ -733,7 +733,7 @@ const EditorComponent = (props) => {
};
const fetchApp = async (startingPageHandle, onMount = false) => {
const _appId = props?.params?.id;
const _appId = props?.params?.id || props?.params?.slug;
if (!onMount) {
await appService.fetchApp(_appId).then((data) => callBack(data, startingPageHandle));
@ -912,7 +912,7 @@ const EditorComponent = (props) => {
//! The computeComponentPropertyDiff function manages the calculation of differences in table columns by requiring complete column data. Without this complete data, the resulting JSON structure may be incorrect.
const paramDiff = computeComponentPropertyDiff(appDefinitionDiff, appDefinition, appDiffOptions);
const updateDiff = computeAppDiff(paramDiff, currentPageId, appDiffOptions, currentLayout);
console.log('----arpit::: appid ==> ', { appId });
updateAppVersion(appId, editingVersion?.id, currentPageId, updateDiff, isUserSwitchedVersion)
.then(() => {
const _editingVersion = {