From c690fcf7fedf0ef40a329e4935b0af17a93a2f36 Mon Sep 17 00:00:00 2001 From: Katherine Date: Thu, 6 Mar 2025 11:10:29 +0800 Subject: [PATCH] fix: build error (#6369) * fix: build error * fix: build --- .../src/block-provider/hooks/useBlockHeightProps.tsx | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/packages/core/client/src/block-provider/hooks/useBlockHeightProps.tsx b/packages/core/client/src/block-provider/hooks/useBlockHeightProps.tsx index a412acba6c..429c2e8dc4 100644 --- a/packages/core/client/src/block-provider/hooks/useBlockHeightProps.tsx +++ b/packages/core/client/src/block-provider/hooks/useBlockHeightProps.tsx @@ -11,7 +11,8 @@ import { useFieldSchema } from '@formily/react'; import { useMemo, useContext } from 'react'; import { useBlockTemplateContext } from '../../schema-templates/BlockTemplateProvider'; import { BlockItemCardContext } from '../../schema-component/antd/block-item/BlockItemCard'; -import { useCurrentRoute } from '../../route-switch'; +import { useAllAccessDesktopRoutes, findRouteBySchemaUid } from '../../route-switch/antd/admin-layout'; +import { useCurrentPageUid } from '../../application/CustomRouterContextProvider'; export const useBlockHeightProps = () => { const fieldSchema = useFieldSchema(); @@ -20,7 +21,13 @@ export const useBlockHeightProps = () => { const pageSchema = useMemo(() => getPageSchema(blockTemplateSchema || fieldSchema), []); const { disablePageHeader, enablePageTabs, hidePageTitle } = pageSchema?.['x-component-props'] || {}; const { titleHeight } = useContext(BlockItemCardContext) || ({} as any); - const currentRoute = useCurrentRoute(); + const { allAccessRoutes } = useAllAccessDesktopRoutes(); + const currentPageUid = useCurrentPageUid(); + + const currentRoute = useMemo( + () => findRouteBySchemaUid(currentPageUid, allAccessRoutes), + [currentPageUid, allAccessRoutes], + ); return { heightProps: { ...cardItemSchema?.['x-component-props'],