-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Fix registration for the TreeView containers #4325
Conversation
@olexii4 as we discussed earlier, there is a pretty good solution using promise. I don't remember exactly (need to test again), but it seems issues with WDYT about this https://github.com/theia-ide/theia/compare/fix-tree-view ? |
@vitaliy-guliy |
I have small remarks. If I am not mistaken, view container (or tree view itself not sure which one) is shown automatically. This could be pretty annoying (like in case with containers plug-in). So if it is not hard and not time consuming, will be nice to have this configurable (to show by default or not). |
@mmorhun it's another issue. And it looks like improvement. You can create issue for that. |
@vitaliy-guliy @olexii4 Could you describe both proposals with pros and cons ? |
@sunix Oleksii will split fix and refactoring on two PRs. |
@vitaliy-guliy I've added only containers registration changes. WDYT? |
this.containersWidgets.set(viewContainer.id, widget); | ||
if (!this.pending) { | ||
this.pending = this.pendingReady(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we can delete pendingReady()
method and use this.applicationStateService.reachedState('ready')
directly.
When the state is already ready
, it will return resolved promise. If the state still not ready
, it will return a promise, which will be resolved when the state become ready
.
So, the code become shorter.
if (!this.pending) {
this.pending = this.applicationStateService.reachedState('ready');
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok. Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To me these lines should be refactored a bit. From an external point of view it is hard to understand what is this.pending
. Maybe rename it ... but just pending
doesn't mean anything to me.
Also, what if state 'ready' is already reached the first time ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Frontend application startup consists of the following steps:
- start frontend contributions
- attach the application shell to the host element
- initialize the application shell layout
- reveal the application shell if it was hidden by a startup indicator (state 'ready')
If state 'ready' is already reached the first time will be returned a new promise (deferred.promise)
https://github.com/theia-ide/theia/blob/master/packages/core/src/browser/frontend-application-state.ts#L61
https://github.com/theia-ide/theia/blob/master/packages/core/src/common/promise-util.ts#L26
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good. Thanks!
Signed-off-by: Oleksii Orel <oorel@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I approve it because it is working and fix the issue but I think this part deserve a deeper refactoring. I have some doubt about the behaviour if multiple TreeView get registered.
Done |
Done |
Signed-off-by: Oleksii Orel <oorel@redhat.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot !
What does this PR do?
Fix registration for the TreeView containers.
What issues does this PR fix or reference?
#3907
Signed-off-by: Oleksii Orel oorel@redhat.com