From b6ea5646c4919b85ead428d62f6db923c605152e Mon Sep 17 00:00:00 2001 From: mydearxym Date: Thu, 7 Mar 2024 15:52:37 +0800 Subject: [PATCH] chore(vercel): fix landing switch --- src/app/Landing/index.tsx | 2 +- src/app/providers/RootStoreProvider.tsx | 2 +- src/hooks/useMetric.ts | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/app/Landing/index.tsx b/src/app/Landing/index.tsx index 824794670..fcae303d0 100644 --- a/src/app/Landing/index.tsx +++ b/src/app/Landing/index.tsx @@ -15,7 +15,7 @@ import useMetric from '@/hooks/useMetric' import { ROUTE } from '@/constant/route' import LavaLampLoading from '@/widgets/Loading/LavaLampLoading' -import { DesktopOnly, MobileOnly, LinkAble } from '@/widgets/Common' +import { DesktopOnly, LinkAble } from '@/widgets/Common' import Tooltip from '@/widgets/Tooltip' import FaqList from '@/widgets/FaqList' import HomeHeader from '@/widgets/HomeHeader' diff --git a/src/app/providers/RootStoreProvider.tsx b/src/app/providers/RootStoreProvider.tsx index 9c1e0b58a..1d1997e22 100644 --- a/src/app/providers/RootStoreProvider.tsx +++ b/src/app/providers/RootStoreProvider.tsx @@ -49,7 +49,7 @@ const RootStoreWrapper: FC = ({ children }) => { const filterSearchParams = useFilterSearchParams() // NOTE: 目前在没有启动后端的情况下,如果这行代码出现在 useCommunity 之前,会导致 build 后的代码疯狂 - // post 到 /GraphiQL, 奇怪的行为。。 + // post 到 /GraphiQL, 奇怪的行为。。,很怀疑是 URQL 客户端的 Bug .. const theme = useThemeFromURL() const store = useStore({ diff --git a/src/hooks/useMetric.ts b/src/hooks/useMetric.ts index 24b4683ac..c242cf123 100644 --- a/src/hooks/useMetric.ts +++ b/src/hooks/useMetric.ts @@ -2,10 +2,12 @@ import { useContext } from 'react' import { MobXProviderContext } from 'mobx-react' import { usePathname } from 'next/navigation' +import { includes } from 'ramda' import type { TMetric } from '@/spec' import METRIC from '@/constant/metric' import { BANNER_LAYOUT } from '@/constant/layout' +import { ROUTE } from '@/constant/route' /** * NOTE: should use observer to wrap the component who use this hook @@ -19,7 +21,7 @@ const useMetric = (): TMetric => { const pathname = usePathname() - if (pathname === '/') { + if (includes(pathname, ['/', `/${ROUTE.PRICE}`, `/${ROUTE.BOOK_DEMO}`])) { return METRIC.HOME }