From ffcc60cadf24e0e327d941809c2a0325eeb68b98 Mon Sep 17 00:00:00 2001 From: chenos Date: Mon, 26 Aug 2024 15:40:22 +0800 Subject: [PATCH] fix: cannot access 'ActionPage' before initialization (#5125) --- .../antd/action/Action.Page.tsx | 60 +++++++++---------- 1 file changed, 28 insertions(+), 32 deletions(-) diff --git a/packages/core/client/src/schema-component/antd/action/Action.Page.tsx b/packages/core/client/src/schema-component/antd/action/Action.Page.tsx index e06898c3e6..885d1e93e6 100644 --- a/packages/core/client/src/schema-component/antd/action/Action.Page.tsx +++ b/packages/core/client/src/schema-component/antd/action/Action.Page.tsx @@ -15,45 +15,41 @@ import { BackButtonUsedInSubPage } from '../page/BackButtonUsedInSubPage'; import { TabsContextProvider, useTabsContext } from '../tabs/context'; import { useActionPageStyle } from './Action.Page.style'; import { usePopupOrSubpagesContainerDOM } from './hooks/usePopupSlotDOM'; -import { ComposedActionDrawer } from './types'; -export const ActionPage: ComposedActionDrawer = observer( - ({ level }) => { - const filedSchema = useFieldSchema(); - const ctx = useActionContext(); - const { getContainerDOM } = usePopupOrSubpagesContainerDOM(); - const { styles } = useActionPageStyle(); - const tabContext = useTabsContext(); +export function ActionPage({ level }) { + const filedSchema = useFieldSchema(); + const ctx = useActionContext(); + const { getContainerDOM } = usePopupOrSubpagesContainerDOM(); + const { styles } = useActionPageStyle(); + const tabContext = useTabsContext(); - const style = useMemo(() => { - return { - // 20 is the z-index value of the main page - zIndex: 20 + level, - }; - }, [level]); + const style = useMemo(() => { + return { + // 20 is the z-index value of the main page + zIndex: 20 + level, + }; + }, [level]); - if (!ctx.visible) { - return null; - } + if (!ctx.visible) { + return null; + } - const actionPageNode = ( -
- }> - - -
- ); + const actionPageNode = ( +
+ }> + + +
+ ); - const container = getContainerDOM(); + const container = getContainerDOM(); - if (container) { - return createPortal(actionPageNode, container); - } + if (container) { + return createPortal(actionPageNode, container); + } - return actionPageNode; - }, - { displayName: 'ActionPage' }, -); + return actionPageNode; +} ActionPage.Footer = observer( () => {