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

[core] Fixed race condition on contribution initialization #6817

Conversation

federicobozzini
Copy link
Contributor

What it does

It fixes #6807 by delayin the registration of menu actions for the folder operations.

How to test

See #6807.

Review checklist

Reminder for reviewers

@federicobozzini federicobozzini changed the title Fixed race condition on contribution initialization [core] Fixed race condition on contribution initialization Jan 3, 2020
}

async onStart(app: FrontendApplication): Promise<void> {
await this.workspacePreferences.ready;
Copy link
Member

Choose a reason for hiding this comment

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

@federicobozzini should we instead opt for a non-blocking asynchronous call?

Example:

@inject(FrontendApplicationStateService)
protected readonly stateService: FrontendApplicationStateService;

async onStart(app: FrontendApplication): Promise<void> { 
    this.stateService.reachedState('ready').then(
         () => this.updateAddRemoveFolderActions(this.menuRegistry);
    );
}

Copy link
Member

Choose a reason for hiding this comment

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

please don't use FrontendApplicationStateService, FrontendApplicationContribution provides already with sufficient lifecycle hooks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vince-fugnitto I've made it non-blocking.

Copy link
Member

Choose a reason for hiding this comment

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

@federicobozzini with this change I no longer see the toolbar menu item for Add Folder to Workspace, something which is added by:

this.updateAddRemoveFolderActions(this.menuRegistry);

In order for the item to return, one must right-click the empty area in the navigator for the command to exist. This is a regression from master and we may need to adjust.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@vince-fugnitto Can you please be more specific about where that item should be? On master I see it only in the "Explorer" menu (just above the file navigator) and on the context menu opened on right-click in the navigator. I see the item in the same two places on this branch.

This is on the electron version.

Copy link
Member

Choose a reason for hiding this comment

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

I performed additional testing and it does not look to be related to your changes.


For future reference, I was referencing the ... (more toolbar item) from the Explorer widget which contains a menu item for Add Folder to Workspace:

image

@vince-fugnitto vince-fugnitto added bug bugs found in the application navigator issues related to the navigator/explorer labels Jan 3, 2020
Signed-off-by: Federico Bozzini <federico.bozzini@gmail.com>
@akosyakov
Copy link
Member

@vince-fugnitto please merge if it is good

@vince-fugnitto vince-fugnitto merged commit c4b3e2a into eclipse-theia:master Jan 6, 2020
@federicobozzini federicobozzini deleted the contribution-race-condition branch January 8, 2020 09:18
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 navigator issues related to the navigator/explorer
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[core] there seems to be a potential race condition on contribution initialization
3 participants