Skip to content

feat: add opt-in v2 hydration marker support - #7689

Open
Jane Chu (janechu) wants to merge 13 commits into
mainfrom
fix/remove-legacy-hydration-markers
Open

Jane Chu (janechu) wants to merge 13 commits into
mainfrom
fix/remove-legacy-hydration-markers

Conversation

@janechu

@janechu Jane Chu (janechu) commented Sep 3, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request

📖 Description

Adds coordinated, opt-in support for FAST Element 2.x indexed hydration markers while retaining FAST Element 3.x data-free markers as the default.

  • Exports markers_v2 from @microsoft/fast-element/hydration.js for use with enableHydration({ markers: markers_v2 }).
  • Adds a matching markers_v2 option to @microsoft/fast-build across its Rust, WASM, CLI, and configuration APIs.
  • Isolates v2 marker parsing from the default v3 implementation.
  • Adds a FAST Build-generated declarative fixture that exercises normal hydration, repeat reconciliation, references, attributes, and events with v2 markers.
  • Updates migration guidance, package documentation, design documentation, and export sizes.

👩‍💻 Reviewer Notes

The v2 compatibility path is explicitly opt-in on both sides:

enableHydration({ markers: markers_v2 });
{
    "markers_v2": true
}

The client and renderer settings must match. Calls without these options continue using FAST Element 3.x data-free hydration markers.

📑 Test Plan

  • Build and test the microsoft-fast-build Rust crate.
  • Build and test @microsoft/fast-build, including CLI/config option forwarding.
  • Build @microsoft/fast-element.
  • Run the FAST Element Chromium and declarative Chromium suites.
  • Verify the generated v2 fixture hydrates and supports repeat updates, attribute bindings, references, and events.

✅ Checklist

General

  • I have included a change request file using $ npm run change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Agents

  • I have linked to an existing issue in this project that this change addresses
  • I have read the skills
  • I have read the DESIGN.md file(s) in packages relevant to my changes
  • I have updated the DESIGN.md file(s) in packages relevant to my changes

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c66c1387-9a1b-4386-8d0f-a115ef5706db
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c66c1387-9a1b-4386-8d0f-a115ef5706db
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c66c1387-9a1b-4386-8d0f-a115ef5706db
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c66c1387-9a1b-4386-8d0f-a115ef5706db
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c66c1387-9a1b-4386-8d0f-a115ef5706db
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: c66c1387-9a1b-4386-8d0f-a115ef5706db
@janechu Jane Chu (janechu) changed the title fix: remove legacy hydration marker support feat: add opt-in v2 hydration marker support Sep 3, 2026
Jane Chu (janechu) and others added 7 commits September 24, 2026 11:12
…ration-markers

# Conflicts:
#	packages/fast-element/SIZES.md
#	packages/fast-element/src/hydration/target-builder.ts
#	packages/fast-element/test/main.ts
#	sites/website/src/docs/3.x/resources/export-sizes.md
…y lint

- Document that the default v3 hydration marker reader now accepts legacy
  FAST Element 2.x indexed markers as an interoperability fallback, and that
  markers_v2 is the opt-in export for strict v2-only parsing.
- Update the fast-element DESIGN.md, README.md, and hydration migration
  guide accordingly, and refresh the markers_v2 changeset description.
- Add a missing type="button" to the hydration-markers-v2 fixture buttons
  to satisfy lint/a11y/useButtonType, and regenerate the fixture output.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
The default HydrationMarkup strategy no longer falls back to legacy
FAST Element 2.x indexed marker parsing. Only the opt-in markers_v2
strategy recognizes that format, so its parsing logic is tree-shaken
out of the bundle unless explicitly imported. Server output that
still emits legacy indexed markers will fail to hydrate unless
markers_v2 is installed via enableHydration({ markers: markers_v2 }).

Updates documentation (DESIGN.md, README.md, migration guide, JSDoc)
and the changeset to describe the corrected, strict-by-default
contract, and replaces the target-builder.pw.spec.ts test that
asserted the previous fallback behavior with tests confirming the
default reader rejects legacy markers and that markers_v2 resolves
them directly.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ckend

The webui-todo-app example's `webui --plugin=fast` backend still emits
FAST Element 2.x indexed hydration markers. Now that the default
hydration reader is strict v3-only, this example must explicitly
install markers_v2 to keep hydrating correctly. Verified against the
actual server output locally (data-fe-b-*, data-fe-c-*, fe-b$$start/end
markers) and confirmed all 7 ssr-webui-todo Playwright tests pass with
this opt-in in place.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Resolve conflicts in packages/fast-element/SIZES.md and
sites/website/src/docs/3.x/resources/export-sizes.md, both of which
are generated bundle-size reports. Instead of picking a side, rebuilt
@microsoft/fast-element against the merged code and regenerated the
tables via `npm run build:sizes` so the committed numbers reflect the
actual merged output, then synced the website copy to match.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f8d8fde6-1261-4dc4-8023-be1559c48bfa
Resolve conflict in packages/fast-build/DESIGN.md's "Validation"
section: combine this branch's `markers_v2` build config key with
main's `type-source`/`type-source-import` convert config keys (both
landed independently) into one accurate description of the allowed
config keys per packages/fast-build/bin/fast.js.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f8d8fde6-1261-4dc4-8023-be1559c48bfa

This branch has not been deployed

No deployments
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