Skip to content

fix(pages): verify and fix partial-locale fallback recovery and fragment navigation #1994

Closed

Description

@lizhengfeng101

Description

Follow-up to merged #1992 and the partial-locale compatibility requirements in #1895. The maintainer accepted landing the language-level loading optimization while tracking these two fallback/navigation cases separately.

@wzxsdf Please first reproduce the scenarios below against current main using a partial-locale test fixture, then fix the confirmed failures and add regression tests. If a scenario does not reproduce, document the setup and observed behavior before closing it.

All five shipped locales were complete at reviewed commit 0d9501e45078e30dd1c02c3313c1d1120975e79f. These are partial-translation edge cases, not a claim that ordinary reading in the current five languages is generally broken. Use fixtures rather than removing production translations.

1. Successful English loading does not clear a previous fallback error

Reproduction setup: the selected locale translates quickstart but not installation.

  1. Open /docs/installation in that partial locale and fail the first English fallback request.
  2. Switch to English and allow its primary-language load to succeed and populate the cache.
  3. Switch back to the same partial locale and article, without clicking Retry.

Expected: display the available English fallback from the successful cache.

Observed in the isolated effect-state verification: the previous fallback error remains visible until an additional Retry. Primary English success updates docState, not englishFallback; the early return while loading/using English retains fallbackAttemptKey, and returning to the same demand skips the cache lookup.

Make fallback recovery consume successfully loaded English content and invalidate obsolete failed-demand state. Preserve suppression of automatic retry loops for an unchanged failing request.

2. Internal fragment navigation expires before asynchronous fallback content arrives

Reproduction setup: a translated article contains an internal link such as ../installation/#intro, and the destination requires its first English fallback load.

  1. Click that link in the rendered article.
  2. Delay English content beyond the existing animation-frame retry window, or fail the request and recover through Retry.
  3. Resolve the destination content with an intro heading.

Expected: navigate to the destination and scroll to the requested heading once it exists.

Observed in the deterministic frame verification: the click path navigates to the slug without preserving the hash. The one-off heading lookup exhausts its eleven attempts; when the body later arrives, the content-ready effect sees an empty URL hash and does not scroll.

Preserve the fragment in router navigation and let the existing content-ready effect perform destination positioning. Do not solve this by merely increasing the fixed frame limit. Retain fragment behavior through browser back/forward navigation.

Scope

  • pages/src/pages/DocsPage.tsx: English fallback state reconciliation and internal fragment navigation.
  • pages/src/pages/DocsPage.test.tsx: partial-locale, language-switch, real link-click, and delayed-content regression cases.
  • Supporting content-loading code only if needed for successful-cache reconciliation.
  • Preserve normal-language caching, shared page/search data, demand-only English loading, transient in-place Retry, and explicit Reload for repeated chunk failures.

Out of scope: per-article splitting, speculative language prefetching, parallel fallback-download optimization, broad UI/state refactoring, and translation-content changes.

Acceptance Criteria

  • Reproduce and document both scenarios against current main with a partial-locale fixture; distinguish any non-reproducing scenario with evidence.
  • After fallback failure, a successful switch to English followed by a switch back displays the cached fallback without another Retry or network download.
  • A rendered internal link retains its fragment and scrolls after delayed fallback content arrives, including failure followed by successful Retry.
  • Add regression coverage for the two sequences, fragment history navigation, and absence of automatic retry loops or speculative English downloads on fully translated pages.
  • Existing reading, search, language switching, Retry, and Reload behavior remains intact.
  • make check and the documented site checks pass: npm --prefix pages run lint, npm --prefix pages test, npm --prefix pages run typecheck, npm --prefix pages run build, and npm --prefix pages run size.

Context

AI/LLM disclosure

This issue was drafted with OpenAI Codex and informed by an ocr review. Model identifiers were not captured in the review record. The maintainer explicitly requested this follow-up.

Activity

  1. added
    bug
    i18n
    on Nov 18, 2026
  2. wzxsdf commented on Nov 18, 2026

    @wzxsdf
    Contributor

    Thanks for the follow-up. I’m happy to take this on and will verify both scenarios against the current main branch before fixing any confirmed issues and adding regression tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugi18n

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions