fix: hydrate strict event arguments in repeat scopes - #322
Merged
Mohamed Mansour (mohamedmansour) merged 2 commits intoJun 5, 2026
Conversation
Tighten event argument parsing and hydrate multi-root repeat events without legacy metadata support. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Copilot started reviewing on behalf of
Mohamed Mansour (mohamedmansour)
June 5, 2026 18:39
View session
Mohamed Mansour (mohamedmansour)
requested review from
a team,
Akrosh Gandhi (akroshg) and
mcritzjam
June 5, 2026 18:39
Contributor
There was a problem hiding this comment.
Pull request overview
This PR tightens the cross-layer event binding contract (parser output → template metadata types → framework hydration) by making event handler arguments strictly parsed and consistently encoded, and by improving SSR hydration for repeat-scope event arguments and tricky repeat bodies.
Changes:
- Enforce strict event handler syntax in the Rust compiler (reject trailing tokens, invalid handler names, malformed args) and emit
argSpecsas arrays consistently. - Remove legacy event metadata shapes in the framework types/docs and embed event target paths directly in
e[]entries. - Fix SSR hydration edge cases: repeat-scoped event argument wiring in repeat blocks (including multi-root repeat bodies) and initially-empty text bindings.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/webui-framework/src/template.ts | Removes mention of legacy el event-target table from template meta docs. |
| packages/webui-framework/src/template-types.ts | Makes CompiledEventArgs strictly an array shape (drops number legacy encoding). |
| packages/webui-framework/src/element.ts | Updates SSR hydration logic (text-node fallback insertion, repeat multi-root hydration path) and optimizes event listener wiring for common arg shapes. |
| packages/webui-framework/RENDERING.md | Updates runtime metadata documentation to reflect e[] carrying both args and target paths. |
| packages/webui-framework/README.md | Updates public docs/examples to the new strict event-call syntax and event metadata encoding. |
| docs/guide/concepts/interactivity.md | Documents repeat-scope values and supported event handler argument forms. |
| docs/guide/concepts/how-it-works.md | Notes that events are attached with compiled argument scopes during hydration. |
| docs/ai.md | Updates AI reference examples and guidance for event handler arguments and repeat-scope support. |
| DESIGN.md | Updates the specification to match the new event metadata and hydration behavior. |
| crates/webui-parser/src/plugin/webui.rs | Implements strict event handler parsing, validates handler/path grammar, updates root-event encoding, and adds regression tests. |
Use template-aware ordinal lookup when inserting missing SSR text nodes and document trusted marker-stream invariants. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Jane Chu (janechu)
approved these changes
Jun 5, 2026
Mohamed Mansour (mohamedmansour)
added a commit
that referenced
this pull request
Jun 8, 2026
Clusters: - feat: parser comment policy strips template/style comments while preserving legal comments, with CLI, Node, docs, and benchmark coverage (#326, b513efb). - feat: CSS module delivery now emits import-map data URI modules and the commerce demo defaults to module styles (#325, #327, f5cedc3, 88fc307). - fix: repeat-scope event arguments hydrate correctly for framework bindings, including strict argument handling (#317, #322, 11b6a6d, c0bd525). - fix: client binding lifecycle ordering preserves child updates across conditional and repeated DOM paths (#329, 0f40666). - fix: compiled templates preserve raw style text instead of altering author-provided CSS content (#330, 4db730a). - docs: issue forms, contribution/support policy, framework rendering docs, CLI docs, and integration guides were refreshed (#321, #328, plus docs in #322/#325/#326/#329; 6853b4c, f97bdc6). Release bump: - Update Rust workspace crates, internal crate dependency constraints, Cargo.lock package versions, npm packages, platform packages, router/framework/test-support packages, and .NET Directory.Build.props from 0.0.14 to 0.0.15. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@microsoft/webui-frameworkwith the new strict event metadata contract:argSpecsarrays only, event target paths embedded ine[], and no legacyneedsEvent/el[]compatibility path.DESIGN.md,docs/, and framework docs to describe the new event hydration and argument-resolution behavior.Why
PR #317 added support for passing repeat-scope values to event handlers. Since that change is already merged to
mainand backward compatibility is not required, this follow-up locks down the new contract, rejects ambiguous handler syntax, and ensures SSR hydration wires scoped event handlers consistently.Validation
cargo test -p microsoft-webui-parsercd packages/webui-framework && pnpm test:unit && pnpm typecheck:e2e && pnpm exec playwright test tests/fixtures/list/list.spec.tscd docs && pnpm buildcargo xtask check