fix(work-files): surgical removal on delete, no full re-scan - #17
Merged
Merged
Conversation
After deleting a work-file, the UI froze for projects with large .work-files/ trees (e.g. tagpay ~39k files) because the onDelete handler re-ran the synchronous walkWorkFiles disk scan via loadWorkFiles(). The post-delete state is fully derivable: drop the entry from cachedWorkFilesData, decrement its project's totalCount, drop the project if it becomes empty, re-render from cache. Sub-millisecond. The full scan still runs naturally on tab activation, so any external file changes are picked up on the next visit. Also gitignore .work-files/ — it's the canonical Skaleet workspace scratch space and shouldn't be tracked.
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Bug
After deleting a work-file via PR #16's new delete button, the UI froze for ~1-2s on projects with large `.work-files/` trees. Reproduced on tagpay (~39k files).
Cause
The `onDelete` handler called `loadWorkFiles()` which re-runs `get-work-files` IPC → synchronous `walkWorkFiles` recursive disk scan across every project's `.work-files/`. The cap is 200 returned but the walk still visits everything to count + sort.
Fix
The post-delete state is fully derivable from the current cache:
Sub-millisecond. The full scan still runs on tab activation, so external file changes are picked up on the next visit.
Bonus: gitignored `.work-files/` (workspace scratch space convention).
Checks