Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: fix view container 'null' error #6276

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions packages/core/src/browser/view-container.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ export class ViewContainerIdentifier {
@injectable()
export class ViewContainer extends BaseWidget implements StatefulWidget, ApplicationShell.TrackableWidgetProvider {

protected _containerLayout: ViewContainerLayout;
protected panel: SplitPanel;
protected attached = new Deferred<void>();

Expand Down Expand Up @@ -101,15 +102,14 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica
this.addClass('theia-view-container');
const layout = new PanelLayout();
this.layout = layout;
this.panel = new SplitPanel({
layout: new ViewContainerLayout({
renderer: SplitPanel.defaultRenderer,
orientation: this.orientation,
spacing: 2,
headerSize: ViewContainerPart.HEADER_HEIGHT,
animationDuration: 200
}, this.splitPositionHandler)
});
this._containerLayout = new ViewContainerLayout({
renderer: SplitPanel.defaultRenderer,
orientation: this.orientation,
spacing: 2,
headerSize: ViewContainerPart.HEADER_HEIGHT,
animationDuration: 200
}, this.splitPositionHandler);
this.panel = new SplitPanel({ layout: this._containerLayout });
this.panel.node.tabIndex = -1;
layout.addWidget(this.panel);

Expand Down Expand Up @@ -330,7 +330,7 @@ export class ViewContainer extends BaseWidget implements StatefulWidget, Applica
}

get containerLayout(): ViewContainerLayout {
return this.panel.layout as ViewContainerLayout;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand how it can be null: init is called before any other call and it sets panel and its layout.

return this._containerLayout as ViewContainerLayout;
}

protected get orientation(): SplitLayout.Orientation {
Expand Down