diff --git a/frontend/src/Editor/EditorFunc.jsx b/frontend/src/Editor/EditorFunc.jsx index d91c45ef25..c64a5fb5f6 100644 --- a/frontend/src/Editor/EditorFunc.jsx +++ b/frontend/src/Editor/EditorFunc.jsx @@ -1268,14 +1268,12 @@ const EditorComponent = (props) => { }; const switchPage = (pageId, queryParams = []) => { - // document.getElementById('real-canvas').scrollIntoView(); if (currentPageId === pageId && currentState.page.handle === appDefinition?.pages[pageId]?.handle) { return; } const { name, handle } = appDefinition.pages[pageId]; if (!name || !handle) return; - const copyOfAppDefinition = JSON.parse(JSON.stringify(appDefinition)); const queryParamsString = queryParams.map(([key, value]) => `${key}=${value}`).join('&'); diff --git a/frontend/src/_helpers/appUtils.js b/frontend/src/_helpers/appUtils.js index a0fa760004..2f6e91a40f 100644 --- a/frontend/src/_helpers/appUtils.js +++ b/frontend/src/_helpers/appUtils.js @@ -585,6 +585,7 @@ function executeActionWithDebounce(_ref, event, mode, customVariables) { case 'switch-page': { const { name, disabled } = _ref.appDefinition.pages[event.pageId]; + // Don't allow switching to disabled page in editor as well as viewer if (!disabled) { _ref.switchPage(event.pageId, resolveReferences(event.queryParams, getCurrentState(), [], customVariables)); diff --git a/frontend/src/_helpers/utils.js b/frontend/src/_helpers/utils.js index 61f30d2e9f..397a1e4313 100644 --- a/frontend/src/_helpers/utils.js +++ b/frontend/src/_helpers/utils.js @@ -743,7 +743,7 @@ export const generateAppActions = (_ref, queryId, mode, isPreview = false) => { }); return Promise.resolve(); } - const pages = _ref.state.appDefinition.pages; + const pages = _ref.appDefinition.pages; const pageId = Object.keys(pages).find((key) => pages[key].handle === pageHandle); if (!pageId) {