fix: lazily update files to avoid triggering issues dependent on sort order#2643
Merged
fix: lazily update files to avoid triggering issues dependent on sort order#2643
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR aims to fix issues related to file update triggers by lazily updating files to avoid side effects from sort order dependencies. The key changes include:
- Adding a TODO comment in the watcher module to flag planned performance improvements.
- Refactoring the update functions in update_files.rs to use instance methods (via &mut self) instead of static functions, thereby streamlining the update logic.
- Removing the explicit dependency on MgrProxy by replacing its calls with corresponding self method calls.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| yazi-core/src/mgr/watcher.rs | Added a TODO comment to indicate potential performance improvement areas. |
| yazi-core/src/mgr/commands/update_files.rs | Refactored tab update functions to instance methods and removed MgrProxy usage. |
Comments suppressed due to low confidence (1)
yazi-core/src/mgr/watcher.rs:79
- [nitpick] For clarity, consider expanding the TODO comment to specify the planned performance improvements (for example, more efficient directory scanning or lazy processing approaches).
+ // TODO: performance improvement
There was a problem hiding this comment.
Pull Request Overview
This PR addresses an issue with file update ordering by lazily updating files, avoiding issues dependent on the sort order.
- In yazi-core/src/mgr/watcher.rs, a TODO comment was added to flag a potential performance improvement in the trigger_dirs method.
- In yazi-core/src/mgr/commands/update_files.rs, the update operations have been refactored to simplify tab updates by replacing multiple tab-specific update methods with unified instance methods that now take FilesOp by value.
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| yazi-core/src/mgr/watcher.rs | Added a TODO comment to flag potential performance improvements. |
| yazi-core/src/mgr/commands/update_files.rs | Refactored file update logic to use instance methods for lazy update handling. |
Comments suppressed due to low confidence (1)
yazi-core/src/mgr/commands/update_files.rs:67
- [nitpick] The variable name 'calc' is a bit vague; consider renaming it to 'should_calculate' or a similar descriptive name for improved clarity.
let calc = !matches!(op, FilesOp::Size(..) | FilesOp::Deleting(..));
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #2642