Skip to content

[Feature] Keep tree state and selection in 'Files' tab when changing commit in history #1396

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

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

johanw1232
Copy link

In the 'Files' tab for commit history window when previewing the selected file you lose the selection and expand state of all the nodes when selecting a new commit. It would be nice to keep the selection (if possible) when jumping between commits, for a quick glace of the changes made in a single file.

This PR aims to keep the selected item and update the preview to the new commit.

… 'Files' tab when switching between commits.
@love-linger love-linger self-assigned this Jun 6, 2025
@love-linger love-linger added the not-planned It's not planned in the future label Jun 6, 2025
@love-linger
Copy link
Collaborator

  • The directory structures may vary for different revisions.
  • Expanding a folder tree node means running the command git ls-tree -z <REVISION> -- <FOLDER_PATH> once. This will seriously affect the response speed of the entire interface. If the hierarchy is too deep, it may even cause the interface to freeze.
  • For the need to view the changes of the same file under different revisions, it is recommended to use the File Histories feature.

@goran-w
Copy link
Contributor

goran-w commented Jun 6, 2025

  • The directory structures may vary for different revisions.

That is taken care of quite gracefully in this PR, by simply losing the selection (while still keeping the parent folder(s) expanded, if possible).

  • Expanding a folder tree node means running the command git ls-tree -z <REVISION> -- <FOLDER_PATH> once. This will seriously affect the response speed of the entire interface. If the hierarchy is too deep, it may even cause the interface to freeze.

I don't see a big slowdown even several levels deep in a folder with lots of files. (If this is an issue, we could have an option "Preserve selection in file-tree" or similar.)

  • For the need to view the changes of the same file under different revisions, it is recommended to use the File Histories feature.

That is not really the same thing, since this feature also shows the selected file in context at its path in the repo.

Having to drill down repeatedly to the same subfolder hierarchy each time another Commit gets selected is simply frustrating, and it makes the FILES view less useful than it could be.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
not-planned It's not planned in the future
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants