Skip to content

Commit 523975a

Browse files
committed
Prevents stale tree node references
- Clears the internal node map when the tree model is updated
1 parent d4f53f3 commit 523975a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/webviews/apps/shared/components/tree/tree-generator.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,10 @@ export class GlTreeGenerator extends GlElement {
139139

140140
this._model = value;
141141

142+
// Clear stale node map before processing new model
143+
// This prevents stale node references when switching commits or toggling filters
144+
this._nodeMap.clear();
145+
142146
// Build both maps during tree flattening (single traversal)
143147
let treeItems: TreeModelFlat[] | undefined;
144148
if (this._model != null) {

0 commit comments

Comments
 (0)