Skip to content

[FEATURE REQUEST] Maintain scroll position in file list #4570

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 2 commits into
base: master
Choose a base branch
from

Conversation

goonerDroid
Copy link
Contributor

@goonerDroid goonerDroid commented Apr 11, 2025

Related Issues

App: #4528

  • Add changelog files for the fixed issues in folder changelog/unreleased. More info here

QA

@JuancaG05 JuancaG05 changed the title [FEATURE] Maintain scroll position in file list [FEATURE REQUEST] Maintain scroll position in file list Apr 14, 2025
@JuancaG05 JuancaG05 linked an issue Apr 14, 2025 that may be closed by this pull request
10 tasks
Copy link
Collaborator

@JuancaG05 JuancaG05 left a comment

Choose a reason for hiding this comment

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

Hi @goonerDroid! Thanks a lot for your contribution! 🍻

Here I left some comments for you to review 😀, let me know if you have any doubt.

@@ -0,0 +1,6 @@
Feature: Maintain scroll position when user scrolls and navigates in file/folder list
Copy link
Collaborator

Choose a reason for hiding this comment

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

Feature is not a valid prefix for Calens. Check the Calens README.md to see the valid prefixes, I'd say in this case the best one is Enhancement

@@ -0,0 +1,6 @@
Feature: Maintain scroll position when user scrolls and navigates in file/folder list
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is also a limit of characters length for the title, so I would just write the way you named the PR: Maintain scroll position in file list

Comment on lines +801 to +809
saveScrollPosition()

fileListAdapter.updateFileList(
filesToAdd = fileListUiState.folderContent,
fileListOption = fileListUiState.fileListOption,
)

restoreScrollPosition()

Copy link
Collaborator

Choose a reason for hiding this comment

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

Hmmm I don't know if I like this to be here... there are 2 main points that make me doubt here:

  1. The observer where this is located. This is going to be executed everytime fileListUiState is updated, and that is a combine with 5 different variables: the current folder displayed, the file list option, the search filter, the sort type and order and the current space. Everytime one of these is updated, the scroll position is going to be saved (and the previous one restored), so it looks a bit inefficient (and a potential source of glitches)
  2. Seems we're saving just 1 scroll position, but what if we go deep into a several-level folder hierarchy? Would we be able to restore every scroll position of each level?

@@ -94,6 +94,7 @@ class MainFileListViewModel(
fileListOptionParam: FileListOption,
) : ViewModel() {

var lastVisibleItemPositions: IntArray? = null
Copy link
Collaborator

Choose a reason for hiding this comment

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

It's usually less secure to expose variables out of the ViewModel as in this case... but let's see how things go after resolving the previous comments 😉

@JuancaG05
Copy link
Collaborator

Hi @goonerDroid! Are you willing to work further on this? It seems a bit blocked, let us know for planning purpose 😁, thank you!

@goonerDroid
Copy link
Contributor Author

Hi @JuancaG05 I was quite swamped with other work, I've picked this issue again and I am still looking into it. Trying to incorporate your recent comments and will try submitting a reworked solution soon

@JuancaG05
Copy link
Collaborator

Ok! No worries and no hurries, just knowing you didn't abandon is good 😀

@joragua
Copy link
Collaborator

joragua commented Apr 30, 2025

Hi @goonerDroid! How are the changes going? Are you still interested in working on this feature/pull request? If you have doubts, let us know and we will help you! 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FEATURE REQUEST] Maintain scroll position in file list
3 participants