Skip to content

refactor(web): shared createIslandMounter for manual island hydration - #962

Merged
Zach Dunn (zachdunn) merged 1 commit into
mainfrom
claude/mount-island-helper
Sep 12, 2026
Merged

refactor(web): shared createIslandMounter for manual island hydration#962
Zach Dunn (zachdunn) merged 1 commit into
mainfrom
claude/mount-island-helper

Conversation

@zachdunn

Copy link
Copy Markdown
Member

What

Factors the manual React-island hydration lifecycle — read the JSON seed, tear down on astro:before-swap, lazy-import the component, hydrateRoot with the recovered identifierPrefix — into one createIslandMounter helper in react-island.ts.

That ~30-line boilerplate was hand-written in five places: both signed-in layouts (AccountLayout, AdminLayout — the sidebar island) and the files, screenshots, and admin/index pages. Each now calls the helper instead:

const boot = createIslandMounter<FilesSeed>({
  mountId: "ws-files-table",
  seedId: "ws-files-seed",
  load: () => import("...WorkspaceFileTable").then((m) => m.WorkspaceFileTable),
});
onAstroPageLoad(() => void boot());

The import() specifier stays inline so the bundler still code-splits each island; the helper keeps its root in a closure created once per <script>, matching the previous module-level let 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/web typecheck: 0 errors
  • react-island unit tests + full web suite (959) pass
  • oxlint clean; oxfmt + prettier applied
  • Net −104 lines

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.
@changeset-bot

changeset-bot Bot commented Sep 12, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: c094d23

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@coderabbitai

coderabbitai Bot commented Sep 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are limited based on label configuration.

🏷️ Required labels (at least one) (2)
  • coderabbit:review
  • review
🚫 Excluded labels (none allowed) (1)
  • wip

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Advanced

Run ID: 18a37d26-01bf-4a95-87fc-b0693e08d6c7

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

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

@zachdunn
Zach Dunn (zachdunn) merged commit e9a1ebb into main Sep 12, 2026
4 checks passed
@zachdunn
Zach Dunn (zachdunn) deleted the claude/mount-island-helper branch September 12, 2026 00:57
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