files-community / Files

Building the best file manager for Windows
https://files.community
MIT License
32.89k stars 2.1k forks source link

When going back to last folder, remember the location and do not locate twice #15675

Closed RichardLuo0 closed 5 days ago

RichardLuo0 commented 6 days ago

Description

When clicking back or using mouse button 4 to go back to the last folder, it always first locates the first folder, then locates the previously opened folder and puts the opened folder at the first location (sometimes not, so a weird behavior). I made a video to demonstrate: https://1drv.ms/u/s!AvQ5Yi4H3cH9h-E0oGka_iTbSGgOtw?e=Ov0g1d

Steps To Reproduce

  1. go into some folder
  2. go back
  3. You should see it locates the first folder and after 0.1s it locates the previous folder and puts it at the first location.

Requirements

Just remember where I was (the scroll offset), and recover the same view as I click the back button.

Files Version

3.5.0.0

Windows Version

22631.3737

Log File

I don't think this will help

RichardLuo0 commented 6 days ago

It seems the files app just reloads the folder again when I go back to the last folder. For efficiency, maybe add a LRU cache for visited folders?

yaira2 commented 5 days ago

Thank you for the report, the underlying issue is being tracked in this issue #14119. I looked into this once and it had something to do with virtualization but further debugging is needed.

If you prefer to disable this behavior in the meantime, you can turn off the auto scroll setting from the Files & Folders page. image

RichardLuo0 commented 5 days ago

Can you explain how virtualization has anything to do with it? I am sorry but to me, it looks like a purely UI bug:

  1. The last opened folder is not cached. The icons and thumbnails will reload again when I click the back button
  2. The last scroll offset is not stored. It looks like it finds the location of the previous folder and simply scrolls to that folder. I am expecting it will scroll to the same offset when I leave the folder (so the previous folder is not necessarily at the first position).
yaira2 commented 5 days ago

Can you explain how virtualization has anything to do with it?

I'm not sure exactly and why it's only some of the time, but my understanding is that it can't locate the correct position of the item to scroll to.

yaira2 commented 5 days ago

The last scroll offset is not stored. It looks like it finds the location of the previous folder and simply scrolls to that folder. I am expecting it will scroll to the same offset when I leave the folder (so the previous folder is not necessarily at the first position).

This is unpredictable as the folder contents can update.

RichardLuo0 commented 5 days ago

The last scroll offset is not stored. It looks like it finds the location of the previous folder and simply scrolls to that folder. I am expecting it will scroll to the same offset when I leave the folder (so the previous folder is not necessarily at the first position).

This is unpredictable as the folder contents can update.

Yeah, but most of the time it just stays the same, you can restore the scroll offset and content from the cache, and when you find anything different from the actual file system, update the folder list asynchronously. This can help the app be more responsive.