fix(web): 导演台检查 - 隔离开发复现入口的外观初始化请求
This commit is contained in:
@@ -9,6 +9,7 @@ import { FullScreenLoader } from "@/components/ui/aceternity/full-screen-loader"
|
||||
import { getAntThemeConfig } from "@/lib/app-theme";
|
||||
import { applySkinTheme } from "@/lib/skin-themes";
|
||||
import { appQueryClient } from "@/lib/query-client";
|
||||
import { isIsolatedDirectorRepro } from "@/lib/dev-repro";
|
||||
import { useActiveTheme } from "@/stores/canvas/use-canvas-theme-store";
|
||||
import { applyAppearanceMetadata, useAppearanceStore } from "@/stores/use-appearance-store";
|
||||
import { useUserStore } from "@/stores/use-user-store";
|
||||
@@ -35,8 +36,8 @@ export function AppProviders({ children }: { children: ReactNode }) {
|
||||
|
||||
// DEV 复现台必须是同源本地确定性场景:AuthSessionHydrator 会打 /api/auth/session,
|
||||
// ClientRootInit 会打 /api/model-catalog,没有后端时产生真实 502,与导演台无关却会污染判据。
|
||||
// 只精确匹配该路径;生产构建中 import.meta.env.DEV 为 false,本分支被摇树删除。
|
||||
const isolateDevRepro = import.meta.env.DEV && typeof window !== "undefined" && window.location.pathname === "/dev/director-repro";
|
||||
// 与启动入口共用精确路径边界;生产构建中 import.meta.env.DEV 为 false,始终不启用隔离。
|
||||
const isolateDevRepro = typeof window !== "undefined" && isIsolatedDirectorRepro(import.meta.env.DEV, window.location.pathname);
|
||||
|
||||
return (
|
||||
<ConfigProvider locale={zhCN} theme={getAntThemeConfig(dark, appearance.activeSkin)} wave={{ disabled: true }}>
|
||||
|
||||
3
web/src/lib/dev-repro.ts
Normal file
3
web/src/lib/dev-repro.ts
Normal file
@@ -0,0 +1,3 @@
|
||||
export function isIsolatedDirectorRepro(dev: boolean, pathname: string): boolean {
|
||||
return dev && pathname === "/dev/director-repro";
|
||||
}
|
||||
@@ -1,7 +1,12 @@
|
||||
import "@fontsource-variable/inter";
|
||||
import "@fontsource-variable/jetbrains-mono";
|
||||
import { bootstrapAppearance } from "@/services/appearance-bootstrap";
|
||||
import { isIsolatedDirectorRepro } from "@/lib/dev-repro";
|
||||
|
||||
// The public film entry checks its availability independently of workspace bootstrap.
|
||||
if (/^\/welcome\/?$/.test(window.location.pathname)) void import("./welcome-application");
|
||||
else void bootstrapAppearance().finally(() => import("./application"));
|
||||
else {
|
||||
// The backend-free DEV lab must not make requests before AppProviders isolates it.
|
||||
const appearanceReady = isIsolatedDirectorRepro(import.meta.env.DEV, window.location.pathname) ? Promise.resolve() : bootstrapAppearance();
|
||||
void appearanceReady.finally(() => import("./application"));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user