refactor(web): shared createIslandMounter for manual island hydration - #962
Conversation
The read-seed -> teardown-on-swap -> lazy-import -> hydrateRoot lifecycle was hand-written in five places (both signed-in layouts and the files, screenshots, and admin workspaces pages). Extract it into react-island.ts as createIslandMounter and have every site call it, so the mount contract lives in one place. Behavior is unchanged.
|
|
Important Review skippedAuto reviews are limited based on label configuration. 🏷️ Required labels (at least one) (2)
🚫 Excluded labels (none allowed) (1)
Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
uploads-web | c094d23 | Commit Preview URL Branch Preview URL |
Sep 12 2026, 12:54 AM |
What
Factors the manual React-island hydration lifecycle — read the JSON seed, tear down on
astro:before-swap, lazy-import the component,hydrateRootwith the recoveredidentifierPrefix— into onecreateIslandMounterhelper inreact-island.ts.That ~30-line boilerplate was hand-written in five places: both signed-in layouts (
AccountLayout,AdminLayout— the sidebar island) and thefiles,screenshots, andadmin/indexpages. Each now calls the helper instead:The
import()specifier stays inline so the bundler still code-splits each island; the helper keeps itsrootin a closure created once per<script>, matching the previous module-levellet root.Why
Pure refactor, no behavior change. It was flagged in the #961 review as a deferred follow-up (the admin workspaces page made it the 5th copy). One mount contract in one place now.
Verification
@uploads/webtypecheck: 0 errorsreact-islandunit tests + full web suite (959) pass