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

npm scripts tree is empty when activated while explorer view is not visible #7738

Closed
shahar-h opened this issue May 5, 2020 · 1 comment · Fixed by #9229
Closed

npm scripts tree is empty when activated while explorer view is not visible #7738

shahar-h opened this issue May 5, 2020 · 1 comment · Fixed by #9229
Labels
bug bugs found in the application help wanted issues meant to be picked up, require help tree issues related to the tree (ex: tree widget) vscode issues related to VSCode compatibility

Comments

@shahar-h
Copy link
Contributor

shahar-h commented May 5, 2020

Bug Description:

When npm builtin extension is activated while explorer view is not visible , npm scripts tree stays empty.

Steps to Reproduce:

  1. Run theia and open the browser with some node project as workspace root - it should contain at least one script. npm scripts tree should appear with content.
  2. Refresh browser and immediately open some other view (i.e. search view) before npm extension is activated.
  3. Wait for activation of npm extension to finish.
  4. Switch back to explorer view - npm scripts tree is empty. refresh / collapse & expand doesn't help.
    Only browser refresh resolves this.

Note: This issue also happen with other trees, npm is just a convenient example.

I tried to debug the browser code and found that onDidChangeVisibility is not fired in this case:

this.onDidChangeVisibilityEmitter.fire(this.isVisible);

Additional Information

  • Operating System: Windows 10, Debian 10
  • Theia Version: build from master branch
@akosyakov akosyakov added bug bugs found in the application help wanted issues meant to be picked up, require help tree issues related to the tree (ex: tree widget) vscode issues related to VSCode compatibility labels May 5, 2020
@amiramw
Copy link
Member

amiramw commented Jul 9, 2020

After investigation I have some more infromation and question.

It seems that there is a race condition regarding the visibility of view container part.

const tryFireOnDidExpandView = () => {
if (!part.collapsed && part.isVisible) {
toFire.dispose();
}
};
const toFire = new DisposableCollection(
Disposable.create(() => this.onDidExpandViewEmitter.fire(viewId)),
part.onCollapsed(tryFireOnDidExpandView),
part.onDidChangeVisibility(tryFireOnDidExpandView)
);

Due to the use of toFire.dispose() there is only one chance to fire the onDidExpandView event which triggers the preparation of the view. This firing can happen if the part is visible for a short time (due to the if above).
However registerViewDataProvider can be called after that single event was fired and then nothing is displayed.

@akosyakov maybe the event should be fired every time the visibility is changed and not only once?

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 help wanted issues meant to be picked up, require help tree issues related to the tree (ex: tree widget) vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants