From 07e06486b22510875c81a4a768d207e6842e066c Mon Sep 17 00:00:00 2001 From: arpitnath Date: Thu, 26 Oct 2023 11:59:48 +0530 Subject: [PATCH] fixes: updates current state with page data on creating new page --- frontend/src/Editor/EditorFunc.jsx | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/frontend/src/Editor/EditorFunc.jsx b/frontend/src/Editor/EditorFunc.jsx index 5dfc167fa7..6bfe52b1bb 100644 --- a/frontend/src/Editor/EditorFunc.jsx +++ b/frontend/src/Editor/EditorFunc.jsx @@ -1327,6 +1327,20 @@ const EditorComponent = (props) => { isSwitchingPage: true, }, }); + + const { globals: existingGlobals } = currentState; + + const page = { + id: newPageId, + name, + handle, + variables: copyOfAppDefinition.pages[newPageId]?.variables ?? {}, + }; + + const globals = { + ...existingGlobals, + }; + useCurrentStateStore.getState().actions.setCurrentState({ globals, page }); }; const switchPage = (pageId, queryParams = []) => {