Skip to content

Bug: Hydration(render) Error when Using Browser Auto-Translation (e.g., Google Translate) #32557

Closed as not planned
@alphabit-technology

Description

@alphabit-technology

Hydration(render) Error when Using Browser Auto-Translation (e.g., Google Translate)

🐛 Bug Report

When using the browser’s built-in translation feature (e.g., Google Chrome’s "Translate this page"), React Hydration(render) sometimes fails with the following error:

Steps to Reproduce

  1. Next.js Example

  2. Remix Example

    • Open Remix documentation: Client Data guide.
    • Right-click on the page and select "Translate to [any language]" in Google Chrome.
    • Navigate to the ComboBox component and select "dev".
    • Observe the console for errors.
  3. In my own React Framework:

Expected Behavior

React should handle this scenario gracefully without breaking Hydration(render).

Actual Behavior

Hydration(render) breaks with a NotFoundError, likely due to the browser altering the structure of the DOM before React has finished reconciling it. This issue persists even on the official Next.js website and Remix, indicating it is not specific to any particular implementation.

Possible Solutions

  • Improve hydration resilience when encountering unexpected DOM modifications.
  • Provide a built-in way to detect and recover from such changes.
  • Document best practices for handling hydration issues caused by external DOM modifications.

React Version

Tested on:

  • React 19

Environment

  • Browser: Google Chrome (latest)
  • OS: Windows/macOS/Linux

Additional Notes

This issue is difficult to prevent since users can trigger automatic translation at any time. While some frameworks like Next.js and Remix catch the error internally, the root cause still persists, and it would be beneficial if React could handle it more gracefully.

Would appreciate any insights on possible solutions!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Resolution: StaleAutomatically closed due to inactivityStatus: UnconfirmedA potential issue that we haven't yet confirmed as a bug

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions