Skip to content

Commit

Permalink
Only layout breadcrumbs when needed, workaround for #139877
Browse files Browse the repository at this point in the history
  • Loading branch information
jrieken committed Jan 24, 2022
1 parent f9e9120 commit d72bc04
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget.ts
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,20 @@ export class BreadcrumbsWidget {
}

private _render(start: number): void {
let didChange = false;
for (; start < this._items.length && start < this._nodes.length; start++) {
let item = this._items[start];
let node = this._nodes[start];
this._renderItem(item, node);
didChange = true;
}
// case a: more nodes -> remove them
while (start < this._nodes.length) {
const free = this._nodes.pop();
if (free) {
this._freeNodes.push(free);
free.remove();
didChange = true;
}
}

Expand All @@ -311,9 +314,12 @@ export class BreadcrumbsWidget {
this._renderItem(item, node);
this._domNode.appendChild(node);
this._nodes.push(node);
didChange = true;
}
}
this.layout(undefined);
if (didChange) {
this.layout(undefined);
}
}

private _renderItem(item: BreadcrumbsItem, container: HTMLDivElement): void {
Expand Down

0 comments on commit d72bc04

Please sign in to comment.