moonming commented on PR #2064: URL: https://github.com/apache/apisix-website/pull/2064#issuecomment-4829011152
### Independent review summary Mechanism verified against the pinned `@docusaurus/[email protected]` client runtime: - `routes.js` always ends with the catch-all `{ path: '*', component: ComponentCreator('*') }`; `ComponentCreator` returns `Loadable({ loader: () => import('@theme/NotFound') })` for `'*'`. So a client-side navigation to a route absent from a stale build's manifest renders the swizzled `theme/NotFound`, and the recovery `useEffect` runs. - `PendingNavigation` swallows failed route preloads with `.catch((e) => console.warn(e))`, confirming a `window` error/`unhandledrejection` listener would never fire — hence `theme/NotFound` is the correct seam. - `404.html` is server-rendered then hydrated; the effect runs only post-hydration and emits no markup → no hydration mismatch. Detection/loop/SSR safety: - Navigation-timing load-path vs `location.pathname` correctly separates "arrived via SPA navigation" from "server returned this 404 document directly", consistent under this site's `trailingSlash: true`. - Loop-safe by two independent guards: after `reload()` the document's load-path equals the current path (early return), plus the per-path `sessionStorage` key. - `eslint` runs clean (exit 0); the new code type-checks (the only `tsc` note on this file is the pre-existing repo-wide `<Layout>` JSX-props one, and the site builds via Babel). **Known, bounded behavior:** a genuinely-dead *internal* link reached via in-app navigation has load-path ≠ current and will reload exactly once before the real 404 renders (the server then returns `404.html`, load-path == current, so it stops). This is inherent to the heuristic and capped at a single reload. Out of scope (Infra): if the CDN edge still serves a stale HTML document for the path after reload, recovery is deferred — the true root-cause fix is cache-purge-on-deploy / shorter HTML TTL at the ASF/Fastly layer. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
