Skip to content

logMismatchError() called redundantly in loop when SSR has excess child nodes #14855

Closed

Description

@Milkjuiceman

Version

3.6.0-beta.12

Reproduction link

github.com

Steps to reproduce

  1. Open packages/runtime-core/src/hydration.ts
  2. Find the while loop inside hydrateElement at line 431
  3. Observe that isMismatchAllowed() and logMismatchError() are both
    called on every iteration of the loop, once per excess DOM node
  4. Compare with the isMismatchAllowed() or logMismatchError() pattern used
    elsewhere in the same file like hydrateChildren at line 608 where
    the same redundancy exists

What is expected?

isMismatchAllowed() and logMismatchError() should each be called once per mismatch event, regardless of how many excess nodes need to be removed.

What is actually happening?

Both are called N times where N is the number of excess DOM nodes. The console.error only appears once due to the hasLoggedMismatchError guard inside logMismatchError(), but the calls themselves are redundant. The fix is to hoist the check outside the loop:

Activity

  1. added a commit that references this issue on May 27, 2026
    170fc95
  2. locked and limited conversation to collaborators on Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions