Skip to content

fix: require marko@5.39.14 for class-runtime linkAssets support#293

Merged
DylanPiercey merged 1 commit into
mainfrom
claude/marko-vite-hydration-fix-xrt5hd
Jul 15, 2026
Merged

fix: require marko@5.39.14 for class-runtime linkAssets support#293
DylanPiercey merged 1 commit into
mainfrom
claude/marko-vite-hydration-fix-xrt5hd

Conversation

@DylanPiercey

Copy link
Copy Markdown
Contributor

Description

Bumps the class-runtime minimum in minRuntimeVersions (link-assets.ts) to marko@5.39.14, below which the plugin now falls back to the legacy asset orchestration instead of the compiler's linkAssets path. Also bumps the marko/@marko/compiler devDependencies so the suite runs on a version where class linkAssets is active, and adds an isomorphic-link-assets-class fixture (class API + linkAssets + a custom runtimeId).

Motivation and Context

The class runtime's generated withPageAssets page entry only applies a configured runtimeId from marko@5.39.14. On older versions the server serialized component hydration data under the default $MC key while the client entry (compiled with the custom runtimeId) read $<runtimeId>_C and found nothing, so SSR components never hydrated (for example, onMount never firing). No class fixture previously exercised linkAssets, leaving this path untested.

Checklist:

  • I have updated/added documentation affected by my changes.
  • I have added tests to cover my changes.

Generated by Claude Code

The class runtime's generated `withPageAssets` page entry only applies a
configured `runtimeId` from marko@5.39.14. On older versions the server
serialized component hydration data under the default `$MC` key while the
client entry (compiled with the custom runtimeId) read `$<runtimeId>_C`
and never hydrated (for example, `onMount` never firing). Bump the class
minimum in `minRuntimeVersions` so older runtimes fall back to the legacy
asset orchestration, which honors the runtimeId.

Bump the marko/@marko/compiler devDependencies so the fixtures run on a
version where class linkAssets is active, and add an
isomorphic-link-assets-class fixture covering class API + linkAssets with
a custom runtimeId.
@changeset-bot

changeset-bot Bot commented Jul 15, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 5dedc5d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@marko/vite Patch

Not sure what this means? Click here to learn what changesets are.

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

@coderabbitai

coderabbitai Bot commented Jul 15, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

The Marko v5 minimum runtime for linkAssets and entry support is raised to 5.39.14, with corresponding dependency updates and a changeset documenting class-runtime hydration behavior. A new isomorphic SSR fixture adds development and built servers, an HTTP handler, a document template, a stateful component, and a browser click step using a fixed runtime ID.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: raising the Marko version requirement for class-runtime linkAssets support.
Description check ✅ Passed The description matches the diff by explaining the runtime version gate, dependency bumps, and new fixture coverage.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch claude/marko-vite-hydration-fix-xrt5hd

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/__tests__/fixtures/isomorphic-link-assets-class/server.mjs`:
- Around line 11-15: Update the createServer request listener to wrap both
handler and serve calls in try/catch; on failure, send a 500 response only when
res.headersSent is false, while preserving the existing handler-first and serve
fallback flow.

In `@src/__tests__/fixtures/isomorphic-link-assets-class/src/index.js`:
- Around line 3-9: Update the handler function so requests whose URL is not "/"
are explicitly handled: return a 404 response or delegate to the available next
middleware callback. Preserve the existing successful root-route rendering
behavior.

In `@src/__tests__/fixtures/isomorphic-link-assets-class/test.config.ts`:
- Around line 11-15: Update the steps fixture so the click action waits for and
asserts the post-hydration result, specifically that the UI displays “Clicks: 1”
after clicking `#clickable`; optionally also assert “Mounted: true”. Preserve the
existing click while ensuring the step fails when hydration does not invoke
increment.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 6ed0795a-0462-4e64-a3dd-024719f45af5

📥 Commits

Reviewing files that changed from the base of the PR and between 4f722be and 5dedc5d.

⛔ Files ignored due to path filters (3)
  • package-lock.json is excluded by !**/package-lock.json and included by **
  • src/__tests__/fixtures/isomorphic-link-assets-class/__snapshots__/build.expected.md is excluded by !**/__snapshots__/** and included by **
  • src/__tests__/fixtures/isomorphic-link-assets-class/__snapshots__/dev.expected.md is excluded by !**/__snapshots__/** and included by **
📒 Files selected for processing (9)
  • .changeset/class-linkassets-min-version.md
  • package.json
  • src/__tests__/fixtures/isomorphic-link-assets-class/dev-server.mjs
  • src/__tests__/fixtures/isomorphic-link-assets-class/server.mjs
  • src/__tests__/fixtures/isomorphic-link-assets-class/src/index.js
  • src/__tests__/fixtures/isomorphic-link-assets-class/src/stateful.marko
  • src/__tests__/fixtures/isomorphic-link-assets-class/src/template.marko
  • src/__tests__/fixtures/isomorphic-link-assets-class/test.config.ts
  • src/link-assets.ts

Comment thread src/__tests__/fixtures/isomorphic-link-assets-class/server.mjs
Comment thread src/__tests__/fixtures/isomorphic-link-assets-class/src/index.js
Comment thread src/__tests__/fixtures/isomorphic-link-assets-class/test.config.ts
@DylanPiercey
DylanPiercey merged commit b44290d into main Jul 15, 2026
7 checks passed
@DylanPiercey
DylanPiercey deleted the claude/marko-vite-hydration-fix-xrt5hd branch July 15, 2026 15:47
@github-actions github-actions Bot mentioned this pull request Jul 15, 2026
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