Repository navigation
fix: leave the registry first when deleting a project - #59
Merged
Merged
Conversation
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.
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.
Why
After a project was deleted while another tab or browser still had it open, opening the project's address gave a blank page.
deleteProjectdeleted the library first and removed the registry entry only afterwards. With another tab holding the library, the deletion waited, so the project stayed listed.blockedevent, because the deletion request is the one being blocked.loadingand rendered nothing.What changes
data/project-store.ts:deleteProjectremoves 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.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
/p/<id>lands on "My reading" instead of a blank page. It fails without the fix.lastActiveAtis a millisecond later, which happens under full-suite load. Ties are broken by random ids.pnpm checkpassed 3/3 runs. Before, it failed about half the time.