diff --git a/app/client/src/sagas/SnapshotSagas.ts b/app/client/src/sagas/SnapshotSagas.ts index 9429d62ba0..2c60e80ba0 100644 --- a/app/client/src/sagas/SnapshotSagas.ts +++ b/app/client/src/sagas/SnapshotSagas.ts @@ -4,6 +4,7 @@ import { } from "actions/autoLayoutActions"; import type { ApiResponse } from "api/ApiResponses"; import ApplicationApi from "@appsmith/api/ApplicationApi"; +import type { PageDefaultMeta } from "@appsmith/api/ApplicationApi"; import { ReduxActionTypes } from "@appsmith/constants/ReduxActionConstants"; import log from "loglevel"; import type { SnapShotDetails } from "reducers/uiReducers/layoutConversionReducer"; @@ -95,6 +96,20 @@ function* restoreApplicationFromSnapshotSaga() { getLogToSentryFromResponse(response), ); + // update the pages list temporarily with incomplete data. + if (response?.data?.pages) { + yield put({ + type: ReduxActionTypes.FETCH_PAGE_LIST_SUCCESS, + payload: { + pages: response.data.pages.map((page: PageDefaultMeta) => ({ + pageId: page.id, + isDefault: page.isDefault, + })), + applicationId, + }, + }); + } + //update layout positioning type from yield call( updateApplicationLayoutType, @@ -103,14 +118,6 @@ function* restoreApplicationFromSnapshotSaga() { : AppPositioningTypes.FIXED, ); - if (response?.data?.applicationDetail?.appPositioning?.type) { - //update layout positioning type from response - yield call( - updateApplicationLayoutType, - response.data.applicationDetail.appPositioning.type, - ); - } - if (isValidResponse) { //update conversion form state to success yield put( diff --git a/app/client/src/utils/DSLConversions/autoToFixedLayout.ts b/app/client/src/utils/DSLConversions/autoToFixedLayout.ts index de48eda692..db632dc09e 100644 --- a/app/client/src/utils/DSLConversions/autoToFixedLayout.ts +++ b/app/client/src/utils/DSLConversions/autoToFixedLayout.ts @@ -202,8 +202,8 @@ function processMobileCanvasChildren( ...currWidget, topRow: getTopRow(currWidget, true), bottomRow: getBottomRow(currWidget, true), - leftColumn: getLeftColumn(currWidget, true), - rightColumn: getRightColumn(currWidget, true), + leftColumn: Math.floor(getLeftColumn(currWidget, true)), + rightColumn: Math.floor(getRightColumn(currWidget, true)), }; currWidgets = convertAutoWidgetToFixed(currWidgets, childId, true); @@ -261,8 +261,8 @@ function processCanvasChildren( ...currWidget, topRow: getTopRow(currWidget, false), bottomRow: getBottomRow(currWidget, false), - leftColumn, - rightColumn, + leftColumn: Math.floor(leftColumn), + rightColumn: Math.floor(rightColumn), }; currWidgets = convertAutoWidgetToFixed(currWidgets, childId, false); diff --git a/app/client/src/utils/DSLConversions/tests/autoToFixedLayout.test.ts b/app/client/src/utils/DSLConversions/tests/autoToFixedLayout.test.ts index 626af35a96..d56890e037 100644 --- a/app/client/src/utils/DSLConversions/tests/autoToFixedLayout.test.ts +++ b/app/client/src/utils/DSLConversions/tests/autoToFixedLayout.test.ts @@ -564,7 +564,7 @@ describe("test Auto to Fixed Conversion methods", () => { leftColumn: 0, minWidth: 120, parentId: "vv54unn046", - rightColumn: 17.375565610859727, + rightColumn: 17, topRow: 0, type: "BUTTON_WIDGET", widgetId: "5c6gd8ynfa", @@ -696,7 +696,7 @@ describe("test Auto to Fixed Conversion methods", () => { minWidth: 120, parentId: "0", parentRowSpace: 10, - rightColumn: 17.375565610859727, + rightColumn: 17, topRow: 18.599999999999998, type: "BUTTON_WIDGET", widgetId: "n123229jea", @@ -718,7 +718,7 @@ describe("test Auto to Fixed Conversion methods", () => { leftColumn: 0, minWidth: 120, parentId: "0", - rightColumn: 17.375565610859727, + rightColumn: 17, topRow: 13.399999999999999, type: "BUTTON_WIDGET", widgetId: "p6em4n29z7", @@ -741,7 +741,7 @@ describe("test Auto to Fixed Conversion methods", () => { leftColumn: 0, minWidth: 120, parentId: "mw6t1nvt67", - rightColumn: 17.375565610859727, + rightColumn: 17, topRow: 5.2, type: "BUTTON_WIDGET", widgetId: "u0cd188upj", @@ -768,7 +768,7 @@ describe("test Auto to Fixed Conversion methods", () => { }, wixla6nh38: { bottomRow: 7, - leftColumn: 17.375565610859727, + leftColumn: 17, minWidth: 450, parentId: "vv54unn046", rightColumn: 64, @@ -880,7 +880,7 @@ describe("test Auto to Fixed Conversion methods", () => { leftColumn: 0, minWidth: 120, parentId: "vv54unn046", - rightColumn: 17.375565610859727, + rightColumn: 17, topRow: 0, type: "BUTTON_WIDGET", widgetId: "5c6gd8ynfa", @@ -1012,7 +1012,7 @@ describe("test Auto to Fixed Conversion methods", () => { minWidth: 120, parentId: "0", parentRowSpace: 10, - rightColumn: 17.375565610859727, + rightColumn: 17, topRow: 27.000000000000004, type: "BUTTON_WIDGET", widgetId: "n123229jea", @@ -1034,7 +1034,7 @@ describe("test Auto to Fixed Conversion methods", () => { leftColumn: 0, minWidth: 120, parentId: "0", - rightColumn: 17.375565610859727, + rightColumn: 17, topRow: 22.200000000000003, type: "BUTTON_WIDGET", widgetId: "p6em4n29z7", @@ -1057,7 +1057,7 @@ describe("test Auto to Fixed Conversion methods", () => { leftColumn: 0, minWidth: 120, parentId: "mw6t1nvt67", - rightColumn: 17.375565610859727, + rightColumn: 17, topRow: 4.8, type: "BUTTON_WIDGET", widgetId: "u0cd188upj",