From f408362c9186787522f9cb643ba3182fbb62e9f9 Mon Sep 17 00:00:00 2001 From: fish Date: Mon, 6 Jul 2026 15:53:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E5=BC=95=E5=AF=BC=E9=85=8D?= =?UTF-8?q?=E7=BD=AE=E9=A1=B5=E9=9D=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude --- serve/frontend/src/router.tsx | 39 +---------------------------------- 1 file changed, 1 insertion(+), 38 deletions(-) diff --git a/serve/frontend/src/router.tsx b/serve/frontend/src/router.tsx index 6df4fb6..2a7032e 100644 --- a/serve/frontend/src/router.tsx +++ b/serve/frontend/src/router.tsx @@ -2,7 +2,6 @@ import { createBrowserRouter, Navigate } from 'react-router-dom' import { Layout } from './components/Layout' import { Screener } from './pages/Screener' import { Financials } from './pages/Financials' -import { Onboarding } from './pages/Onboarding' import { Auth } from './pages/Auth' import { Data } from './pages/Data' import { Monitor } from './pages/Monitor' @@ -19,47 +18,11 @@ import { UserManage } from './pages/UserManage' import { Settings } from './pages/Settings' import { Indices } from './pages/Indices' import { Dev } from './pages/Dev' -import { useSettings } from './lib/useSharedQueries' -import { Logo } from './components/Logo' - -// 首次使用守卫 —— 未完成向导则重定向到 /onboarding -// 只挂在根路由上;/onboarding 本身不被守卫,避免循环重定向。 -// settings 由 Layout 预取,守卫判定不产生额外请求。 -function OnboardingGuard({ children }: { children: React.ReactNode }) { - const settings = useSettings() - - // 仅首次加载(本地无缓存)时显示占位。 - // 后台重取 (isFetching) 时本地已有上一份缓存可用, 直接放行, 避免切页时整屏 logo 闪烁。 - // 防误重定向已由 Onboarding/AI 等处 invalidate 前的 setQueryData 同步缓存兜底。 - if (settings.isLoading) { - return ( -
-
- -
加载中…
-
-
- ) - } - - // 查询出错或字段缺失时不拦截 —— 宁可放行,也不把用户卡在空白页 - if (settings.data && settings.data.onboarding_completed === false) { - return - } - - return <>{children} -} - export const router = createBrowserRouter([ - { path: '/onboarding', element: }, { path: '/login', element: }, { path: '/', - element: ( - - - - ), + element: , children: [ { index: true, element: }, { path: 'overview', element: },