Skip to content

fix(work-files): surgical removal on delete, no full re-scan - #17

Merged
JeanBaptisteRenard merged 1 commit into
mainfrom
fix/work-files-delete-no-reload
May 24, 2026
Merged

JeanBaptisteRenard merged 1 commit into
mainfrom
fix/work-files-delete-no-reload

Conversation

@JeanBaptisteRenard

Copy link
Copy Markdown
Collaborator

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:

  • find entry in `cachedWorkFilesData` → `splice`
  • decrement its project's `totalCount`
  • drop the project if it becomes empty
  • re-render

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

  • 53/53 tests pass
  • 0 lint errors (220 pre-existing warnings)

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.
@JeanBaptisteRenard
JeanBaptisteRenard merged commit 1cc2510 into main May 24, 2026
6 checks passed
@JeanBaptisteRenard
JeanBaptisteRenard deleted the fix/work-files-delete-no-reload branch May 24, 2026 09:32
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.

1 participant