Skip to content

Commit

Permalink
only renderBody when view is visible/expanded (#165187)
Browse files Browse the repository at this point in the history
fixes PaneView calls renderBody even when the pane is collapsed #164662
  • Loading branch information
sbatten authored Nov 1, 2022
1 parent d5d392b commit 8f06fd3
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/vs/base/browser/ui/splitview/paneview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ export abstract class Pane extends Disposable implements IView {

private expandedSize: number | undefined = undefined;
private _headerVisible = true;
private _bodyRendered = false;
private _minimumBodySize: number;
private _maximumBodySize: number;
private _ariaHeaderLabel: string;
Expand Down Expand Up @@ -158,6 +159,11 @@ export abstract class Pane extends Disposable implements IView {
this.updateHeader();

if (expanded) {
if (!this._bodyRendered) {
this.renderBody(this.body);
this._bodyRendered = true;
}

if (typeof this.animationTimer === 'number') {
clearTimeout(this.animationTimer);
}
Expand Down Expand Up @@ -249,7 +255,13 @@ export abstract class Pane extends Disposable implements IView {
});

this.body = append(this.element, $('.pane-body'));
this.renderBody(this.body);

// Only render the body if it will be visible
// Otherwise, render it when the pane is expanded
if (!this._bodyRendered && this.isExpanded()) {
this.renderBody(this.body);
this._bodyRendered = true;
}

if (!this.isExpanded()) {
this.body.remove();
Expand Down

0 comments on commit 8f06fd3

Please sign in to comment.