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

TreeError [myTreeDataProvider] Data tree node not found when selecting and deleting last child element in tree item #142700

Closed
katsoohoo opened this issue Feb 10, 2022 · 4 comments
Assignees
Labels
info-needed Issue requires more information from poster

Comments

@katsoohoo
Copy link

katsoohoo commented Feb 10, 2022

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.64.1
  • OS Version: macOS 11.6

Steps to Reproduce:

Sample extension with steps 1 - 3 available at https://github.com/katsoohoo/treeview-extension

  1. Build an extension with a tree view
  2. In the tree view, create a collapsible root and one child to the root element
  3. Create a VS Code command to delete the child element
  4. When running the extension, select the child element and run the delete command
  5. The root element becomes non-collapsible and the following error occurs in the console:
    rejected promise not handled within 1 second: Error: TreeError [myTreeDataProvider] Data tree node not found: [object Object]
    /Applications/Visual Studio Code.app/Contents/Resources/app/out/vs/workbench/services/extensions/node/extensionHostProcess.js:112
    stack trace: Error: TreeError [myTreeDataProvider] Data tree node not found: [object Object]
        at se.getDataNode ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:201:19917]())
        at se.getNode ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:201:17566]())
        at fe ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:655:34927]())
        at [vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:67:4675]()
        at [vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:67:4808]()
        at Array.forEach (<anonymous>)
        at r.bufferEvents ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:67:4797]())
        at v.setCollapsible ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:82:10582]())
        at v.spliceSimple ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:82:9606]())
        at v.splice ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:82:7530]())
        at A._setChildren ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:82:17603]())
        at A.setChildren ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:82:17005]())
        at I.setChildren ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:201:6680]())
        at se.render ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:201:23336]())
        at se.refreshAndRenderNode ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:201:20057]())
        at processTicksAndRejections (internal[/process/task_queues.js:93:5]())
        at async se._updateChildren ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:201:17119]())
        at async se.updateChildren ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:201:16785]())
        at async Promise.all (index 0)
        at async pe.doRefresh ([vscode-file://vscode-app/Applications/Visual%20Studio%20Code.app/Contents/Resources/app/out/vs/workbench/workbench.desktop.main.js:2587:15187]())
    

bug

Notes:

  • The error only occurs if there is only one child in an element and the child element is the current selection
  • When firing a change without specifying an element (this.onDidChangeTreeDataEmitter.fire()), the error does not occur
@katsoohoo
Copy link
Author

katsoohoo commented Feb 16, 2022

We have a temporarily workaround where we focus on the parent node before removing the last child node. Specifically, we call TreeView.reveal() with focus: true. The select option doesn't matter in this case.

The sample GitHub repo has been updated with the workaround as comments.

@alexr00
Copy link
Member

alexr00 commented Feb 21, 2022

Thank you for the clear sample! I tried it out, and I can reproduce the issue in 1.64.*, but not in insiders. @katsoohoo would you be able to try out VS Code Insiders and see if you can reproduce the issue there?

@alexr00 alexr00 added the info-needed Issue requires more information from poster label Feb 21, 2022
@katsoohoo
Copy link
Author

Hi @alexr00, thanks for confirming. I cannot reproduce the error in 1.65.0-insider. Do you have an estimate on when the fix will be in the stable release?

@alexr00
Copy link
Member

alexr00 commented Feb 22, 2022

We're about to start our endgame, so maybe next week: #143606

@alexr00 alexr00 closed this as completed Feb 22, 2022
@github-actions github-actions bot locked and limited conversation to collaborators Apr 8, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
info-needed Issue requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants
@jrieken @katsoohoo @alexr00 and others