fix: deleting an island wedges the dev server#3883
Open
aiibe wants to merge 2 commits into
Open
Conversation
Author
|
Pushed a follow up. Fixing the wedge exposed a related client side bug where a surviving sibling island stopped hydrating. Added a guard and updated the description. |
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.
The problem
Delete any file from
islands/while runningdeno task devand the app crashes on reload page with a permanent 500 until you restart. Fresh auto discovers that folder so it happens even when the island isn't used anywhere.Second bug: delete one island while another is still on the page and the surviving island quietly stops reacting after the next reload.
Steps to reproduce
deno task devand open/about. It renders theFooandBarislands.about.tsxremove<Bar />and its import so the page keeps onlyFoo.islands/Bar.tsx.Foorendered but dead so it no longer reacts to clicks.What was happening
The watcher only looked at
routes/so deleting an island never triggered a rebuild. The snapshot map only ever added islands and never dropped deleted ones, leaving a stale static import that choked the server. And on a cold client graph right after a delete, a surviving island's boot import got recorded as the internalfresh-island::Namespecifier, so the browser got a bare import it couldn't resolve and the island never hydrated.The fix
The watcher now tracks islands too. The
loadhandler rebuilds the island map from scratch on every reload instead of appending, with a small cache so names stay stable. And it skips thefresh-island::Namespecifier when recording a chunk, keeping the real/@id/...URL so a survivor always boots.Testing
One regression test loads a page with a live island, deletes a sibling, then checks the server stays at 200 and the survivor still hydrates and stays clickable with no
fresh-island::in the HTML.