From 5ea44e05d0197f1229859d951541e3019a284036 Mon Sep 17 00:00:00 2001 From: Colin Grant Date: Wed, 2 Jun 2021 12:57:00 -0500 Subject: [PATCH] Track index in Pref Tree to facilitate automatic scrolling Signed-off-by: Colin Grant --- .../preferences/src/browser/views/preference-tree-widget.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/preferences/src/browser/views/preference-tree-widget.tsx b/packages/preferences/src/browser/views/preference-tree-widget.tsx index 746afafc20d7c..185165acccbf7 100644 --- a/packages/preferences/src/browser/views/preference-tree-widget.tsx +++ b/packages/preferences/src/browser/views/preference-tree-widget.tsx @@ -54,9 +54,10 @@ export class PreferencesTreeWidget extends TreeWidget { doUpdateRows(): void { this.rows = new Map(); + let index = 0; for (const [id, nodeRow] of this.model.currentRows.entries()) { if (nodeRow.visibleChildren > 0 && (ExpandableTreeNode.is(nodeRow.node) || ExpandableTreeNode.isExpanded(nodeRow.node.parent))) { - this.rows.set(id, nodeRow); + this.rows.set(id, { ...nodeRow, index: index++ }); } } this.updateScrollToRow();