From 9c28519e312f8537ebb509caf3c3506176733609 Mon Sep 17 00:00:00 2001 From: Lars Fernhomberg Date: Mon, 13 Nov 2023 13:04:55 +0000 Subject: [PATCH] fix(taxonomy tree): options remain selected when switching in single mode This is a hack fix since the tree is already built on top of React anti-patterns, which cause this in the first place. In the future a full refactor is really required to sort this out at its roots. By adding an unstable `key`, it forces the component to re-render on every render. Without this, React assumes nothing has changed and does not react to the `selectedKey` update. For large trees with everything expanded, this could cause performance issues but should be okay in most cases. --- src/controls/modernTaxonomyPicker/taxonomyTree/TaxonomyTree.tsx | 1 + 1 file changed, 1 insertion(+) diff --git a/src/controls/modernTaxonomyPicker/taxonomyTree/TaxonomyTree.tsx b/src/controls/modernTaxonomyPicker/taxonomyTree/TaxonomyTree.tsx index 0d732505f..6ed69c76e 100644 --- a/src/controls/modernTaxonomyPicker/taxonomyTree/TaxonomyTree.tsx +++ b/src/controls/modernTaxonomyPicker/taxonomyTree/TaxonomyTree.tsx @@ -659,6 +659,7 @@ export function TaxonomyTree( className={styles.taxonomyItemFocusZone} >