Skip to content

fix: deduplicate deprecated event arg warning in fast-html template processing#7441

Merged
janechu merged 5 commits intomainfrom
users/janechu/reduce-e-warnings
Apr 16, 2026
Merged

fix: deduplicate deprecated event arg warning in fast-html template processing#7441
janechu merged 5 commits intomainfrom
users/janechu/reduce-e-warnings

Conversation

@janechu
Copy link
Copy Markdown
Collaborator

@janechu janechu commented Apr 15, 2026

Pull Request

📖 Description

Deduplicate the deprecated e event argument warning in @microsoft/fast-html template processing. Previously, console.warn fired for every event binding that used the legacy e syntax across every <f-template> on the page, flooding the console with 60+ identical messages.

Now the warning fires at most once per unique component name and includes the component name in the message, making it easy to locate which components still use the deprecated syntax.

🎫 Issues

👩‍💻 Reviewer Notes

The fix uses a module-scoped Set<string> keyed by component name (this.name) to gate the warning. This approach was chosen over an instance-level flag because multiple <f-template> elements can share the same name, and we want exactly one warning per unique component name.

📑 Test Plan

  • Added a new deprecated-event-warning fixture with two components (test-alpha with two e bindings, test-beta with one) to verify:
    • Only one warning per component (not per binding)
    • Each component gets its own warning
    • Warning message includes the component name and replacement syntax
  • Updated the existing event fixture test to assert the warning includes the component name
  • All 259 existing tests continue to pass

✅ 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.

janechu and others added 4 commits April 16, 2026 13:14
…mponent name

Add a module-scoped Set to track which components have already emitted the
deprecation warning for the legacy "e" event argument. The warning now fires
at most once per unique component name and includes the component name in the
message to help developers locate usage.

Closes #7409

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

Move the deprecated "e" warning from per-binding to per-template evaluation.
A private _hasDeprecatedE flag is set during template processing and checked
once after resolveStringsAndValues completes, emitting a single warning per
f-template element.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu janechu force-pushed the users/janechu/reduce-e-warnings branch from db9a13a to 6277716 Compare April 16, 2026 20:16
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@janechu janechu marked this pull request as ready for review April 16, 2026 20:23
@janechu janechu requested a review from Copilot April 16, 2026 22:53
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR reduces console noise in @microsoft/fast-html by deduplicating the deprecation warning for legacy e event arguments during <f-template> processing, and improves debuggability by including the component name in the warning.

Changes:

  • Track deprecated e usage during template parsing and emit a single warning after processing (instead of warning per event binding).
  • Add a new Playwright fixture (deprecated-event-warning) to validate warning deduplication and message content.
  • Update docs (README + DESIGN) to describe the deduplicated warning behavior and component-name inclusion.

Reviewed changes

Copilot reviewed 12 out of 12 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/fast-html/src/components/template.ts Moves warning emission to a single post-processing point and includes component name in the warning.
packages/fast-html/test/fixtures/event/event.spec.ts Asserts the warning message includes the component name.
packages/fast-html/test/fixtures/deprecated-event-warning/* New fixture + tests validating deduplication behavior across components.
packages/fast-html/README.md Documents “warn once per component” behavior and name inclusion.
packages/fast-html/DESIGN.md Updates syntax constant table description for deprecated e.
change/@microsoft-fast-html-*.json Beachball change entry for the fix.

Comment thread packages/fast-html/src/components/template.ts
@janechu janechu merged commit 2594122 into main Apr 16, 2026
21 checks passed
@janechu janechu deleted the users/janechu/reduce-e-warnings branch April 16, 2026 23:25
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.

fix: deduplicate deprecated event arg warning in fast-html template processing

2 participants