Files
Jyotisha/frontend/src/lib/home-onboarding-shell-loader.ts
T
Jesse_ChenandClaude Opus 5.5 b743b16b00 perf(home): city table, sealed-holdout JSON and the onboarding shell leave the first screen (BUG-1130)
The China city table loads on demand; old code-only profiles load it before
the people list settles, so they resolve exactly as before. The gate keeps
the six holdout fields it reads, pinned to the JSON by a test. The
onboarding shell is preloaded before reveal only when the profile is
incomplete.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01N4f2nya58RoRu4yEmJgRGE
2026-10-01 00:31:53 +08:00

28 lines
895 B
TypeScript

import type { HomeOnboardingShell as HomeOnboardingShellComponent } from "@/components/home-onboarding-shell";
type Shell = typeof HomeOnboardingShellComponent;
let loaded: Shell | null = null;
let loading: Promise<Shell> | null = null;
/** One import per tab; a failed chunk can be retried. */
export function loadHomeOnboardingShell(): Promise<Shell> {
loading ??= import("@/components/home-onboarding-shell").then((module) => {
loaded = module.HomeOnboardingShell;
return loaded;
}, (error: unknown) => {
loading = null;
throw error;
});
return loading;
}
export function loadedHomeOnboardingShell(): Shell | null {
return loaded;
}
/** Cold boot, before reveal, when the profile is incomplete (home-bootstrap-run.ts). */
export function preloadHomeOnboardingShell(): Promise<void> {
return loadHomeOnboardingShell().then(() => undefined, () => undefined);
}