This repository was archived by the owner on Sep 30, 2024. It is now read-only.
svelte: Fix file tree behavior#62538
Merged
Merged
Conversation
Contributor
Author
|
@vovakulikov That should fix the issue you discovered when expanding a directory via the chevron and subsequently selecting a file in it. |
camdencheek
approved these changes
May 8, 2024
camdencheek
left a comment
Member
There was a problem hiding this comment.
LGTM! +1 to using ancestors. That should be way cheaper for opening a file from root.
While working on #62494 I noticed that the file tree didn't work as expected. In particular, when being at the repo root and navigating to a file via the fuzzy finder the file tree would switch to the parent directory, just like as if the file was directly navigated to. However, what should happen is that the tree expands all directories to reveal the file, because the repo root is the top level directory and we should always be showing the most top level directory that was visited. The issue is that we are not properly detecting the repo root level (I think we switched from using `'.'` to `''` at some point). To avoid this problem I'm now using a constant instead. I also changed how the tree entries are scrolled into view. The current solution doesn't work for deeply nested entries because at the time the scroll logic is invoked the entry hasn't been loaded yet. By moving the logic to the node it can scroll itself into view when it's available. The waterfall loading nature of the file tree also became much more apparent. We can avoid this by using making use of the `ancestors` field but that needs to be done in a separate PR because that entails larger changes.
54abf95 to
af04bd8
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
While working on #62494 I noticed that the file tree didn't work as expected.
In particular, when being at the repo root and navigating to a file via the fuzzy finder the file tree would switch to the parent directory, just like as if the file was directly navigated to.
However, what should happen is that the tree expands all directories to reveal the file, because the repo root is the top level directory and we should always be showing the most top level directory that was visited.
The issue is that we are not properly detecting the repo root level (I think we switched from using
'.'to''at some point). To avoid this problem I'm now using a constant instead.I also changed how the tree entries are scrolled into view. The current solution doesn't work for deeply nested entries because at the time the scroll logic is invoked the entry hasn't been loaded yet. By moving the logic to the node it can scroll itself into view when it's available.
The waterfall loading nature of the file tree also became much more apparent. We can avoid this by using making use of the
ancestorsfield but that needs to be done in a separate PR because that entails larger changes.Test plan
Manual testing.