From 2a16b341e7ff4815a40a7bb8ddc89cffa257fb42 Mon Sep 17 00:00:00 2001 From: arpitnath Date: Mon, 23 Oct 2023 21:18:07 +0530 Subject: [PATCH] fixes: on delete version fetchApp fails --- frontend/src/Editor/AppVersionsManager/List.jsx | 12 +++++++----- frontend/src/Editor/EditorFunc.jsx | 4 ++-- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/frontend/src/Editor/AppVersionsManager/List.jsx b/frontend/src/Editor/AppVersionsManager/List.jsx index 40dbb10aed..8c43752e4c 100644 --- a/frontend/src/Editor/AppVersionsManager/List.jsx +++ b/frontend/src/Editor/AppVersionsManager/List.jsx @@ -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, diff --git a/frontend/src/Editor/EditorFunc.jsx b/frontend/src/Editor/EditorFunc.jsx index 8e7fcae85e..b1ecb327f2 100644 --- a/frontend/src/Editor/EditorFunc.jsx +++ b/frontend/src/Editor/EditorFunc.jsx @@ -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 = {