Repository navigation
Description
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.
- Open
/docs/installationin that partial locale and fail the first English fallback request. - Switch to English and allow its primary-language load to succeed and populate the cache.
- 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.
- Click that link in the rendered article.
- Delay English content beyond the existing animation-frame retry window, or fail the request and recover through Retry.
- Resolve the destination content with an
introheading.
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
mainwith 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 checkand the documented site checks pass:npm --prefix pages run lint,npm --prefix pages test,npm --prefix pages run typecheck,npm --prefix pages run build, andnpm --prefix pages run size.
Context
- Reviewed snapshot:
0d9501e45078e30dd1c02c3313c1d1120975e79f; PR perf(pages): lazy-load documentation content by language #1992 merged as8f9ce54026cf2d08feb989a40d5f8de1ba89e6e4. - Fallback early return and failed-demand key.
- Content-ready fragment effect and internal link handler.
- Passing Pages CI for the reviewed head: 97 tests passed. Those tests do not cover the two combined sequences above.
- Review evidence consists of code inspection, a mocked fallback-effect state trace, and a deterministic frame harness. These were not full React/browser reproductions, which is why contributor verification is the first step.
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
wzxsdf commentedon Nov 18, 2026
Thanks for the follow-up. I’m happy to take this on and will verify both scenarios against the current
mainbranch before fixing any confirmed issues and adding regression tests.