fix(home): prefetch the warm snapshot from secondary pages so the first 新建对话 skips the loading ring (BUG-1104)

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
This commit is contained in:
Jesse_Chen
2026-09-29 20:28:59 +08:00
co-authored by Claude Opus 5.5
parent b19d0bbf36
commit fee9ddc8a1
12 changed files with 329 additions and 8 deletions
+5 -5
View File
@@ -14,7 +14,6 @@ import { HomeBootstrapError } from "@/components/home-bootstrap-error";
import { HomeOnboardingShell } from "@/components/home-onboarding-shell";
import { BirthSkyReveal } from "@/components/birth-sky/birth-sky-reveal";
import {
entrySummaryFromResponse,
rectificationEntryLabels,
resolveRectificationEntryAction,
} from "@/lib/rectification-entry";
@@ -159,12 +158,14 @@ import {
discardLegacyCloudMirrorKeys,
fetchCloudChartLibrary,
fetchCloudSynastryHistory,
fetchRectificationEntrySummary,
payloadCode,
payloadMessage,
waitForUndoWindow,
} from "@/lib/home-cloud-sync";
import { runHomeBootstrap, runHomeWarmRefresh } from "@/lib/home-bootstrap-run";
import { writeHomeWarmSnapshot } from "@/lib/home-warm-snapshot";
import { markHomeReadyAfterNewChat } from "@/lib/new-chat-timing";
import {
homeWarmStartInput,
mountedHomeWarmStart,
@@ -507,10 +508,8 @@ export default function Home() {
if (bootstrapPhase === "account" || !accountId || !sessionListSettled) return;
void (async () => {
try {
const response = await fetch("/api/rectification/cases/entry-summary", { cache: "no-store" });
if (!response.ok) return;
const payload = await response.json().catch(() => null);
setRectificationEntrySummary(entrySummaryFromResponse(payload));
const summary = await fetchRectificationEntrySummary();
if (summary) setRectificationEntrySummary(summary);
} catch {
// The CTA falls back to the server-agnostic default labels.
} finally {
@@ -523,6 +522,7 @@ export default function Home() {
// incomplete one (no catalog, summary not settled, error) is never written.
useEffect(() => {
if (!hydrated || uiPreview.current || accountError || !accountId || !modelCatalog || !rectificationEntrySummarySettled) return;
markHomeReadyAfterNewChat();
writeHomeWarmSnapshot({
accountId,
modelCatalog,