Skip to content

Commit 69a7f10

Browse files
authored
fix: make progressBar and progressIndicator optional, add null checks for viewWelcomeController (microsoft#254799)
1 parent c6e6e69 commit 69a7f10

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

src/vs/workbench/browser/parts/views/viewPane.ts

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ export abstract class ViewPane extends Pane implements IView {
342342

343343
readonly menuActions: ViewMenuActions;
344344

345-
private progressBar!: ProgressBar;
346-
private progressIndicator!: IProgressIndicator;
345+
private progressBar?: ProgressBar;
346+
private progressIndicator?: IProgressIndicator;
347347

348348
private toolbar?: WorkbenchToolBar;
349349
private readonly showActions: ViewPaneShowActions;
@@ -355,7 +355,7 @@ export abstract class ViewPane extends Pane implements IView {
355355
private iconContainer?: HTMLElement;
356356
private iconContainerHover?: IManagedHover;
357357
protected twistiesContainer?: HTMLElement;
358-
private viewWelcomeController!: ViewWelcomeController;
358+
private viewWelcomeController?: ViewWelcomeController;
359359

360360
private readonly headerActionViewItems: DisposableMap<string, IActionViewItem> = this._register(new DisposableMap());
361361

@@ -625,7 +625,7 @@ export abstract class ViewPane extends Pane implements IView {
625625
}
626626

627627
protected layoutBody(height: number, width: number): void {
628-
this.viewWelcomeController.layout(height, width);
628+
this.viewWelcomeController?.layout(height, width);
629629
}
630630

631631
onDidScrollRoot() {
@@ -634,7 +634,6 @@ export abstract class ViewPane extends Pane implements IView {
634634

635635
getProgressIndicator() {
636636
if (this.progressBar === undefined) {
637-
// Progress bar
638637
this.progressBar = this._register(new ProgressBar(this.element, defaultProgressBarStyles));
639638
this.progressBar.hide();
640639
}
@@ -660,7 +659,7 @@ export abstract class ViewPane extends Pane implements IView {
660659
}
661660

662661
focus(): void {
663-
if (this.viewWelcomeController.enabled) {
662+
if (this.viewWelcomeController?.enabled) {
664663
this.viewWelcomeController.focus();
665664
} else if (this.element) {
666665
this.element.focus();

0 commit comments

Comments
 (0)