Skip to content

fix: leave the registry first when deleting a project - #59

Merged
bencode merged 1 commit into
mainfrom
fix/deleted-project-blank
Oct 1, 2026
Merged

bencode merged 1 commit into
mainfrom
fix/deleted-project-blank

Conversation

@bencode

@bencode bencode commented Oct 1, 2026

Copy link
Copy Markdown
Owner

Why

After a project was deleted while another tab or browser still had it open, opening the project's address gave a blank page.

  1. deleteProject deleted the library first and removed the registry entry only afterwards. With another tab holding the library, the deletion waited, so the project stayed listed.
  2. Opening the project then queued its library open behind the pending deletion. That open never finishes, and it fires no blocked event, because the deletion request is the one being blocked.
  3. Since fix: let a newer tab upgrade the library instead of waiting silently #54, boot waits for the library before rendering, so the page stayed on loading and rendered nothing.

What changes

  • data/project-store.ts: deleteProject removes the registry entry (and the workspace keys in localStorage) first, then deletes the library. Once the entry is gone, the project's address leads to another project, as a deleted project's address already did. Deleting the library is now cleanup that finishes once other tabs let go.
  • No intermediate "deleting" state is stored. A persisted temporary flag would need its own cleanup when interrupted.

Trade-off

The previous order let a failed library deletion be retried, because the project stayed listed. Now a deletion that fails or is interrupted leaves an unlisted library taking space, and nothing else. This is rare, and the cost is far smaller than a project that cannot be opened.

Tests

  • New integration test: another tab holds the library, the deletion waits, and opening /p/<id> lands on "My reading" instead of a blank page. It fails without the fix.
  • Fixed the flaky "deletes only what this tab asked for" test.
    • It waited for the Files list after opening whichever project was most recent. The new, empty project wins whenever its lastActiveAt is a millisecond later, which happens under full-suite load. Ties are broken by random ids.
    • It now waits for the Files panel, which both projects have. Test-only change.
    • pnpm check passed 3/3 runs. Before, it failed about half the time.

While another tab held a project's library, its deletion waited and the
project stayed listed. Opening the project then queued behind the deletion and
never finished, leaving a blank page. The project now leaves the registry
first, so its address leads to another project; deleting the library is
cleanup that finishes once other tabs let go.

The deletion test also waited for a file list that only appears when the
non-empty project happens to be the most recent one, which made it flaky.
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