Skip to content

Fix locale-switch hydration mismatches while preserving UI - #7

Merged
YaMaiDay merged 1 commit into
mainfrom
codex/fix-locale-hydration
Nov 18, 2026
Merged

YaMaiDay merged 1 commit into
mainfrom
codex/fix-locale-hydration

Conversation

@YaMaiDay

Copy link
Copy Markdown
Collaborator

Switching languages rewrote incoming server-rendered UI labels to English before Fern initialized React, producing recoverable React #418 errors. Remove that normalization and its forced client-only fallback. Keep the existing label translations, but schedule them in a post-render task after island readiness so deferred React content can finish its current render turn. A read-only React DOM ownership check also waits for host bindings inside delayed Suspense boundaries; only pending connected targets are retried, and the queue drains after adoption.

The interface dictionaries, article content, CSS, navigation behavior and Safari renderer-loading workaround are unchanged. New regressions preserve incoming SSR text, attributes and loading strategies across all 20 locales, before and after the interface bridge loads, and verify that localization waits beyond the current render frame.

Validation:

  • Full documentation checks and 34 Chromium/WebKit browser tests pass.
  • Live Fern pages with the checkout scripts substituted: all 20 locale transitions pass in Chromium without React initialization errors; repeated WebKit transitions cover the previously intermittent locales without React initialization errors.
  • Native Chinese, Traditional Chinese, Ukrainian and Arabic UI/control labels match the previous source in both engines; no pending retries remain after hydration.
  • 204 browser state comparisons and 14 screenshots match the previous source.
  • The new SSR preservation regression rejects both failure paths in the previous source.

Native Safari 26.6.2 WebDriver acceptance was unavailable because Allow Remote Automation is disabled; WebKit results are not presented as native Safari results.

Preserve incoming Fern SSR labels and hydration strategies instead of rewriting
labels to English or forcing client-only remounts. Defer existing UI label sync
past the current render frame and wait for React host bindings inside deferred
Suspense content before mutating labels. Drain pending retries after adoption.

Keep all visible dictionaries, navigation behavior and the Safari renderer guard
unchanged. Cover both loading phases across all locales and post-render timing
with regression checks.

@6mm-official 6mm-official left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Reviewed c8f6aa8. No blocking findings in the SSR preservation, deferred React binding checks, nested-island readiness, or disconnected-node cleanup. Local npm run check passes (97 workflow, 9 navigation, and 19 Safari guard tests, plus documentation and Fern validation); the PR CI including Chromium/WebKit regressions is green. The README records the React DOM marker compatibility boundary for future renderer upgrades.

@YaMaiDay
YaMaiDay merged commit e0e0872 into main Nov 18, 2026
1 check passed
@YaMaiDay
YaMaiDay deleted the codex/fix-locale-hydration branch November 18, 2026 06:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants