Skip to content

fix(core): detect static text hydration mismatches - #70215

Open
splincode wants to merge 1 commit into
angular:mainfrom
splincode:splincode/fix-hydration-static-text-mismatch
Open

fix(core): detect static text hydration mismatches#70215
splincode wants to merge 1 commit into
angular:mainfrom
splincode:splincode/fix-hydration-static-text-mismatch

Conversation

@splincode

Copy link
Copy Markdown
Contributor

PR Checklist

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • angular.dev application / infrastructure changes
  • Other... Please describe:

What is the current behavior?

Hydration validates text nodes by node type only. A third-party script or browser extension can insert same-shaped DOM with different static text and shift hydration claims without producing a mismatch error.

Issue Number: #56392

What is the new behavior?

Hydration also validates non-empty static text content in development mode. When the DOM text differs from the template, Angular reports NG0500 with the expected and actual content and points to the mismatched location.

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

No documentation update is needed because this change does not introduce or modify a public API.

Tested with:

pnpm bazel test //packages/platform-server/test:test --test_arg=--seed=15039

Validate static text content in addition to node type so injected DOM
with the same element shape cannot silently shift hydration claims.

Report expected and actual content in NG0500 to identify the exact
location of the mismatch.

Refs angular#56392
@pullapprove
pullapprove Bot requested a review from kirjs August 15, 2026 18:27
@angular-robot angular-robot Bot added the area: core Issues related to the framework runtime label Aug 15, 2026
@ngbot ngbot Bot added this to the Backlog milestone Aug 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area: core Issues related to the framework runtime

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant