Skip to content

Commit

Permalink
EDSC-3910: Adding a unique identifier for key prop so component re-…
Browse files Browse the repository at this point in the history
…mounts on each change to either variable
  • Loading branch information
eudoroolivares2016 committed Nov 17, 2023
1 parent ab8a713 commit 2ce8053
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
3 changes: 2 additions & 1 deletion static/src/js/components/ProjectPanels/VariableTreePanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const VariableTreePanel = (props) => {

const selectedMethod = accessMethods[selectedAccessMethod]
const {
id: selectedAccessMethodServiceConceptId = '',
keywordMappings = [],
hierarchyMappings = [],
selectedVariables = [],
Expand Down Expand Up @@ -81,7 +82,7 @@ export const VariableTreePanel = (props) => {
<ProjectPanelSection heading="Variable Selection">
{keywordMappings.length > 0 && hierarchyMappings.length > 0 && browseBy}
<Tree
key={treeView}
key={`${selectedAccessMethodServiceConceptId}_${treeView}`}
collectionId={collectionId}
index={index}
items={items}
Expand Down
2 changes: 1 addition & 1 deletion static/src/js/components/Tree/Tree.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ export const Tree = ({
variables,
onUpdateFinished: forceUpdate
})
}, [variables]) // Update TreeModel when the list of variables changes
}, []) // Only execute this useEffect once on initial render

/**
* Update the treeModel with new values
Expand Down
2 changes: 1 addition & 1 deletion static/src/js/util/tree/TreeNode.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ export class TreeNode {
}

/**
* Seralizes the selected items into an array of the fullValues
* Serializes the selected items into an array of the fullValues
*/
seralize() {
const checked = []
Expand Down

0 comments on commit 2ce8053

Please sign in to comment.