Skip to content

Commit 5ce2d3d

Browse files
fix(spreadsheet-view): don't unmount component on node change (#3311)
* fix(spreadsheet-view): don't unmount component on node change Signed-off-by: Joris Mancini <[email protected]> * chore: enhance comments Signed-off-by: Joris Mancini <[email protected]> --------- Signed-off-by: Joris Mancini <[email protected]>
1 parent 1510a60 commit 5ce2d3d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/components/study-pane.jsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,8 +109,9 @@ const StudyPane = ({
109109
showGrid={showGrid}
110110
/>
111111
</div>
112-
{/* using a key in these TabPanelLazy because we can change the nodeUuid in this component */}
113-
<TabPanelLazy key={`spreadsheet-${currentNode?.id}`} selected={view === StudyView.SPREADSHEET}>
112+
{/* This TabPanelLazy is used on a multi-node component so we don't want to reset it at each node change,
113+
so we don't specify a key */}
114+
<TabPanelLazy selected={view === StudyView.SPREADSHEET}>
114115
<SpreadsheetView
115116
studyUuid={studyUuid}
116117
currentNode={currentNode}
@@ -121,6 +122,8 @@ const StudyPane = ({
121122
openDiagram={openVoltageLevelDiagram}
122123
/>
123124
</TabPanelLazy>
125+
{/* using a key in these TabPanelLazy because we can change the nodeUuid in this component,
126+
and we want to reset the component at each node change*/}
124127
<TabPanelLazy key={`results-${currentNode?.id}`} selected={view === StudyView.RESULTS}>
125128
<ResultViewTab
126129
studyUuid={studyUuid}
@@ -131,9 +134,13 @@ const StudyPane = ({
131134
view={view}
132135
/>
133136
</TabPanelLazy>
137+
{/* using a key in these TabPanelLazy because we can change the nodeUuid in this component,
138+
and we want to reset the component at each node change*/}
134139
<TabPanelLazy selected={view === StudyView.LOGS} key={`logs-${currentNode?.id}`}>
135140
<ReportViewerTab visible={view === StudyView.LOGS} currentNode={currentNode} disabled={disabled} />
136141
</TabPanelLazy>
142+
{/* using a key in these TabPanelLazy because we can change the nodeUuid in this component,
143+
and we want to reset the component at each node change*/}
137144
<TabPanelLazy key={`parameters-${currentNode?.id}`} selected={view === StudyView.PARAMETERS}>
138145
<ParametersTabs view={view} />
139146
</TabPanelLazy>

0 commit comments

Comments
 (0)