docs(ui): explain page and shared component lifecycle boundaries

This commit is contained in:
2026-11-12 16:11:24 +08:00
parent 5d82655e0e
commit cc2172319e
10 changed files with 19 additions and 5 deletions
+2
View File
@@ -21,12 +21,14 @@ export default async function Home() {
signal: AbortSignal.timeout(15000),
});
// 按响应状态确定是否已认证,再丢弃不需要的body;此处不解析profile字段。
// 先保存 HTTP 成功判定;随后 cancel 若抛错,catch 不会把 authenticated 重置为 false。
authenticated = response.ok;
await response.body?.cancel();
} catch {
// An unverified session must not hide the public landing page.
}
}
// redirect 放在上方 try/catch 外,避免把框架用于导航的控制流异常当作 profile 请求失败吞掉。
// 仅在确认成功后跳工作台,未认证时沿用同一静态展示组件。
if (authenticated) redirect("/dashboard");
return <LandingPage />;