From 71fcdfb6a44ed35fb41d6689319f3cec9020d47c Mon Sep 17 00:00:00 2001 From: arpitnath Date: Fri, 6 Jan 2023 18:37:27 +0530 Subject: [PATCH 1/3] fixes: persisted state for components from duplicate pages --- frontend/src/Editor/Box.jsx | 1 + frontend/src/Editor/Editor.jsx | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/frontend/src/Editor/Box.jsx b/frontend/src/Editor/Box.jsx index 75a2753b21..b8aa5d8204 100644 --- a/frontend/src/Editor/Box.jsx +++ b/frontend/src/Editor/Box.jsx @@ -282,6 +282,7 @@ export const Box = function Box({ {inCanvas ? ( !resetComponent ? ( Date: Sat, 7 Jan 2023 11:13:33 +0530 Subject: [PATCH 2/3] Expose page id in viewer also --- frontend/src/Editor/Viewer.jsx | 2 ++ 1 file changed, 2 insertions(+) diff --git a/frontend/src/Editor/Viewer.jsx b/frontend/src/Editor/Viewer.jsx index f38b68dc45..ef06cb1498 100644 --- a/frontend/src/Editor/Viewer.jsx +++ b/frontend/src/Editor/Viewer.jsx @@ -154,6 +154,7 @@ class ViewerComponent extends React.Component { }, variables: {}, page: { + id: currentPage.id, handle: currentPage.handle, name: currentPage.name, variables: {}, @@ -337,6 +338,7 @@ class ViewerComponent extends React.Component { name: targetPage.name, handle: targetPage.handle, variables: this.state.pages?.[pageIdCorrespondingToHandleOnURL]?.variables ?? {}, + id: pageIdCorrespondingToHandleOnURL, }, }, }, From 4ad4515703000edb63afab836b10607d40d19085 Mon Sep 17 00:00:00 2001 From: Sherfin Shamsudeen Date: Sat, 7 Jan 2023 23:18:50 +0530 Subject: [PATCH 3/3] Change the position of id inside page object --- frontend/src/Editor/Editor.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/Editor/Editor.jsx b/frontend/src/Editor/Editor.jsx index 6588c8bc83..f3f927e376 100644 --- a/frontend/src/Editor/Editor.jsx +++ b/frontend/src/Editor/Editor.jsx @@ -1622,10 +1622,10 @@ class EditorComponent extends React.Component { const { globals: existingGlobals } = this.state.currentState; const page = { + id: pageId, name, handle, variables: this.state.pages?.[pageId]?.variables ?? {}, - id: pageId, }; const globals = {