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

Automatically expand the last expanded folder when the page is refreshed in web. #187788

Closed
Tracked by #187898
yiliang114 opened this issue Jul 13, 2023 · 3 comments
Closed
Tracked by #187898
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded vscode.dev Issues related to vscode.dev
Milestone

Comments

@yiliang114
Copy link
Contributor

For example when I open a project in vscode.de v, I expand the folder on the file tree. When I refresh the whole page, the default behavior now is that the folders are collapsed, which means that I need to expand the folders one by one again the last time I opened them.

feat2

@yiliang114
Copy link
Contributor Author

If the expansion state of the file tree folder can remember the last expansion like tabs, similar to the gif below, I think this is a better effect.

feat3

@lramos15 lramos15 added bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues vscode.dev Issues related to vscode.dev labels Jul 13, 2023
@yiliang114
Copy link
Contributor Author

I have fixed this problem and will mention a pr later.

yiliang114 added a commit to yiliang114/vscode that referenced this issue Jul 14, 2023
@yiliang114
Copy link
Contributor Author

@lramos15 The reason for this problem is that there are multiple calls to the this.tree.setInput function during the rendering of the file tree.

The state will be read from the cache for the first time, but before the execution is completed for the first time, the setInput will be executed again. At this time, the tree already has a value. However, because the file tree data is not ready (because the data on the Web side is asynchronous), the state returned by the getViewState function is empty, resulting in the final file tree returning to the default collapsed state.

if (this.tree && this.tree.getInput()) {

@vscodenpa vscodenpa added the unreleased Patch has not yet been released in VS Code Insiders label Jul 17, 2023
@vscodenpa vscodenpa added this to the July 2023 milestone Jul 17, 2023
@vscodenpa vscodenpa added insiders-released Patch has been released in VS Code Insiders and removed unreleased Patch has not yet been released in VS Code Insiders labels Jul 18, 2023
@sandy081 sandy081 added the verified Verification succeeded label Jul 26, 2023
@github-actions github-actions bot locked and limited conversation to collaborators Aug 31, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug file-explorer Explorer widget issues insiders-released Patch has been released in VS Code Insiders verified Verification succeeded vscode.dev Issues related to vscode.dev
Projects
None yet
Development

No branches or pull requests

4 participants