Skip to content
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

Feature: Auto refresh after adding items if no directory watcher is available #13068

Merged
merged 4 commits into from
Aug 1, 2023

Conversation

hishitetsu
Copy link
Member

@hishitetsu hishitetsu commented Jul 25, 2023

This doesn't solve the problem of occasional non-refresh on SMB servers, but solves the problem of always non-refresh on locations that don't support directory watchers, such as FTP servers, WSL folders, MTP devices, and archives.

Resolved / Related Issues

  • Were these changes approved in an issue or discussion with the project maintainers? In order to prevent extra work, feature requests and changes to the codebase must be approved before the pull request will be reviewed. This prevents extra work for the contributors and maintainers.
    Related to Bug: SMB / MTP / some network folders won't refresh after changes #5869

Validation
How did you test these changes?

  • Did you build the app and test your changes?
  • Did you check for accessibility? You can use Accessibility Insights for this.
  • Did you remove any strings from the en-us resource file?
    • Did you search the solution to see if the string is still being used?
  • Did you implement any design changes to an existing feature?
    • Was this change approved?
  • Are there any other steps that were used to validate these changes?
    1. Open a location that doesn't support directory watchers, such as FTP servers, WSL folders, MTP devices, and archives.
    2. Add/Paste/Rename/Drop items.
    3. The page will automatically refresh to show the added/changed items.

@gave92
Copy link
Member

gave92 commented Jul 25, 2023

I feel like I need a recap of the available watchers :)

Name Method Used for Update Notes
WatchForDirectoryChanges ReadDirectoryChangesW Local folders, network shares (SMB?) Per file OK only for windows shares?
WatchForStorageFolderChanges StorageItemQueryResult MTP? WSL? Whole list Does it work?
WatchForWin32FolderChanges FileSystemWatcher Box Drive folder Whole list Still needed?
RefreshIfNoWatcherExists Manual update FTP Whole list New!

@hishitetsu
Copy link
Member Author

hishitetsu commented Jul 26, 2023

Here is my perception. Should MTP and WSL use RefreshIfNoWatcherExists?

Name Method Used for Update Notes
WatchForDirectoryChanges ReadDirectoryChangesW Local folders, network shares (SMB), WSL Per file Sometimes detection fails on network shares (maybe when the server has large latency?) / Doesn't work with WSL
WatchForStorageFolderChanges StorageItemQueryResult MTP, Fallback if FindFirstFileExFromApp fails Whole list It doesn't seem to work with MTP.
WatchForWin32FolderChanges FileSystemWatcher Box Drive folder Whole list Still needed? I have not been able to test it.
RefreshIfNoWatcherExists Manual update FTP, Archives Whole list This is not a watcher, so it can't detect changes by other applications.

@hishitetsu
Copy link
Member Author

I looked into WSL. I see that WatchForDirectoryChanges is applied to WSL but it doesn't seem to work. Other watchers don't seem to work with WSL as well.

@hishitetsu hishitetsu marked this pull request as draft July 26, 2023 16:24
@hishitetsu hishitetsu changed the title Feature: Auto refresh after adding items if no directory watcher exists Feature: Auto refresh after adding items if no directory watcher is available Jul 27, 2023
@hishitetsu hishitetsu marked this pull request as ready for review July 27, 2023 15:56
@hishitetsu
Copy link
Member Author

Added support for WSL and MTP.

Name Method Used for Update Notes
WatchForDirectoryChanges ReadDirectoryChangesW Local folders, network shares (SMB) Per file Sometimes detection fails on network shares (maybe when the server has large latency?)
WatchForStorageFolderChanges StorageItemQueryResult Fallback if FindFirstFileExFromApp fails Whole list
WatchForWin32FolderChanges FileSystemWatcher Box Drive folder Whole list Still needed? I have not been able to test it, so I leave it as is.
RefreshIfNoWatcherExists Manual update FTP, Archives, WSL, MTP Whole list This is not a watcher, so it can't detect changes by other applications.

@yaira2
Copy link
Member

yaira2 commented Jul 31, 2023

@hishitetsu @gave92 is this ready for review?

@hishitetsu
Copy link
Member Author

@hishitetsu @gave92 is this ready for review?

Yes.

Copy link
Member

@yaira2 yaira2 left a comment

Choose a reason for hiding this comment

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

LGTM

@yaira2 yaira2 added ready to merge Pull requests that are approved and ready to merge and removed needs - code review labels Aug 1, 2023
@yaira2 yaira2 merged commit f4ddd25 into files-community:main Aug 1, 2023
@hishitetsu hishitetsu deleted the AutoRefresh branch August 1, 2023 01:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Pull requests that are approved and ready to merge
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants