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

Conversation

vince-fugnitto
Copy link
Member

@vince-fugnitto vince-fugnitto commented Sep 26, 2019

What it does

Fixes #6231

Set the ViewContainerLayout explicitly so it is not null when it is being used.

How to test

Re-test the following functionality present in #5665

Review checklist

Reminder for reviewers

Signed-off-by: Vincent Fugnitto vincent.fugnitto@ericsson.com

Fixes #6231

- set the `ViewContainerLayout` explicitly so it is not `null`
when it is being used.

Signed-off-by: Vincent Fugnitto <vincent.fugnitto@ericsson.com>
@vince-fugnitto vince-fugnitto added bug bugs found in the application plug-in system issues related to the plug-in system labels Sep 26, 2019
@vince-fugnitto
Copy link
Member Author

I meant to create a draft PR but it looked like Github had a slight hiccup.
I'm wondering if this is the correct approach to fixing the issue where the ViewContainer layout may be null, or if explicit type checks should be added to ensure it is not.

@@ -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.

@kittaakos
Copy link
Contributor

ViewContainer layout may be null

I cannot reproduce it anymore. Does anyone know the exact steps?

@svenefftinge
Copy link
Contributor

This fixes only the symptom not the underlying problem, which is those widgets are disposed (widget dispose nulls the layout).
A parent gets disposed here:
https://github.com/eclipse-theia/theia/blob/master/packages/plugin-ext/src/main/browser/view/plugin-view-registry.ts#L410
which disposes all its children.

@kittaakos
Copy link
Contributor

Does anyone know the exact steps?

Open the Plugins view and refresh the browser.

I can see, there is a view container with test ID. I do not yet see where does it come from:
Screen Shot 2019-09-27 at 08 51 50

Strangely, there is only one test view container registered:
Screen Shot 2019-09-27 at 08 56 24

@kittaakos
Copy link
Contributor

Got it finally, the exception is thrown because Test view is not opened. We do not see the same error for SCM and Debug because both views are opened and initialized as part of the default application shell layout.

I can confirm, the error is gone if I open the Test view, and I refresh the browser while the Plugins view is the active widget on the left-hand side.

This fixes only the symptom not the underlying problem

I second this. We need another fix.

@vince-fugnitto
Copy link
Member Author

@kittaakos @svenefftinge thanks for helping find the root cause, I initially wanted to have the PR as a draft specifically for that reason.

I don't quite understand why the container has to be disposed on initWidgets.

@vince-fugnitto vince-fugnitto changed the title Fix view container error wip: fix view container 'null' error Sep 27, 2019
@akosyakov
Copy link
Member

@vince-fugnitto On new deployment a plugin can be removed then its views and view containers should be removed. You can reproduce it by stopping a server, removing a plugin contributing a view and starting a server. A client should reconnect and remove view containers. Apparently we don't remove all references to view container afterwards.

@vince-fugnitto
Copy link
Member Author

@vince-fugnitto On new deployment a plugin can be removed then its views and view containers should be removed. You can reproduce it by stopping a server, removing a plugin contributing a view and starting a server. A client should reconnect and remove view containers. Apparently we don't remove all references to view container afterwards.

Thank you for the clarification :)

@vince-fugnitto vince-fugnitto deleted the vf/fix-view-container branch April 20, 2020 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application plug-in system issues related to the plug-in system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError: Cannot read property 'widgets' of null
4 participants