Skip to content

Handle multiple scripts when deciding whether to hydrate blocks - #59

Merged
elemdos merged 1 commit into
masterfrom
fix/hydration-multiple-scripts
Oct 8, 2026
Merged

elemdos merged 1 commit into
masterfrom
fix/hydration-multiple-scripts

Conversation

@elemdos

@elemdos elemdos commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

An empty <script module></script> before an interactive instance script made primo build skip the client bundle, leaving controls inert. The hydration check now inspects every script and bundles the block when any script has content.

Adds a regression fixture that verifies the counter bundle and hydration import. The startup test also selects an isolated port so an existing server on port 3000 cannot affect its result.

Validation: the full suite with companion PRs #57 and #58 passes on Node 22: 132 passed, two skipped. The same suite passes against the prepared primo-mcp 0.1.10 package. Completes the hydration correction for #58.

Summary by CodeRabbit

  • Bug Fixes
    • Builds now correctly generate the client-side bundle when a component has an empty module script followed by an interactive script. The resulting page can load its interactive features as expected.
    • Improved build coverage verifies that generated pages include the required client-side code.

@coderabbitai

coderabbitai Bot commented Oct 8, 2026

Copy link
Copy Markdown

Review in Change Stack →

Note

Currently processing new changes in this PR. This may take a few minutes, please wait...

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 0b68ac81-c671-41bb-9de2-518e263cbce9
📥 Commits

Reviewing files that changed from the base of the PR and between f2332e3 and 7fee90a.

📒 Files selected for processing (3)
  • src/commands/build.ts
  • tests/build-hydration-scripts.test.mjs
  • tests/site-ids.test.mjs
 ___________________________________________________________________________________________________________________
< Work with a user to think like a user. It's the best way to gain insight into how the system will really be used. >
 -------------------------------------------------------------------------------------------------------------------
  \
   \   \
        \ /\
        ( )
      .( o ).
✨ Finishing Touches
📝 Generate docstrings
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autopilot · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

@elemdos
elemdos merged commit 34deb1d into master Oct 8, 2026
1 of 2 checks passed
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