Skip to content

Commit 74ccd51

Browse files
authored
list: avoid messing with the DOM unless absolutely necessary (microsoft#208913)
fixes microsoft#206585
1 parent 78447f9 commit 74ccd51

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/vs/base/browser/ui/list/listView.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -607,7 +607,7 @@ export class ListView<T> implements IListView<T> {
607607
renderer.disposeElement(item.element, i, item.row.templateData, item.size);
608608
}
609609

610-
rows.push(item.row);
610+
rows.unshift(item.row);
611611
}
612612

613613
item.row = null;
@@ -924,7 +924,9 @@ export class ListView<T> implements IListView<T> {
924924

925925
if (item.stale || !item.row.domNode.parentElement) {
926926
const referenceNode = this.items.at(index + 1)?.row?.domNode ?? null;
927-
this.rowsContainer.insertBefore(item.row.domNode, referenceNode);
927+
if (item.row.domNode.parentElement !== this.rowsContainer || item.row.domNode.nextElementSibling !== referenceNode) {
928+
this.rowsContainer.insertBefore(item.row.domNode, referenceNode);
929+
}
928930
item.stale = false;
929931
}
930932

0 commit comments

Comments
 (0)