mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-24 01:18:23 +00:00
fixes: page switch action via runjs actions (#7762)
This commit is contained in:
parent
1e772c04f7
commit
cdd3411e7a
3 changed files with 2 additions and 3 deletions
|
|
@ -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('&');
|
||||
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
|
|
|
|||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue