Merge pull request #5247 from ToolJet/component-state-persists-duplicate-pages

Multipage: component and current state is persisted for duplicate pages
This commit is contained in:
Sherfin Shamsudeen 2023-01-09 12:06:52 +05:30 committed by GitHub
commit 54a9cc378c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 1 deletions

View file

@ -282,6 +282,7 @@ export const Box = function Box({
{inCanvas ? (
!resetComponent ? (
<ComponentToRender
key={`${id}${currentState.page.id}`}
onComponentClick={onComponentClick}
onComponentOptionChanged={onComponentOptionChanged}
currentState={currentState}

View file

@ -1622,7 +1622,7 @@ class EditorComponent extends React.Component {
const { globals: existingGlobals } = this.state.currentState;
const page = {
...this.state.currentState.page,
id: pageId,
name,
handle,
variables: this.state.pages?.[pageId]?.variables ?? {},

View file

@ -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,
},
},
},