Skip to content
This repository was archived by the owner on Sep 30, 2024. It is now read-only.

svelte: Fix file tree behavior#62538

Merged
fkling merged 2 commits into
mainfrom
fkling/sk/fix-file-tree
May 8, 2024
Merged

svelte: Fix file tree behavior#62538
fkling merged 2 commits into
mainfrom
fkling/sk/fix-file-tree

Conversation

@fkling

@fkling fkling commented May 8, 2024

Copy link
Copy Markdown
Contributor

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.

Test plan

Manual testing.

@fkling fkling added the team/code-search Issues owned by the code search team label May 8, 2024
@fkling fkling requested a review from a team May 8, 2024 11:49
@fkling fkling self-assigned this May 8, 2024
@cla-bot cla-bot Bot added the cla-signed label May 8, 2024
@fkling

fkling commented May 8, 2024

Copy link
Copy Markdown
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 camdencheek left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM! +1 to using ancestors. That should be way cheaper for opening a file from root.

fkling added 2 commits May 8, 2024 16:14
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.
@fkling fkling force-pushed the fkling/sk/fix-file-tree branch from 54abf95 to af04bd8 Compare May 8, 2024 14:15
@fkling fkling merged commit 4df95dc into main May 8, 2024
@fkling fkling deleted the fkling/sk/fix-file-tree branch May 8, 2024 15:07
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

cla-signed team/code-search Issues owned by the code search team

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants