From fe989bb71c8db75c10d80b57386173ee4a0c60c4 Mon Sep 17 00:00:00 2001 From: chenos Date: Sat, 10 Jun 2023 12:43:36 +0800 Subject: [PATCH] fix(acl): import SettingsCenterContext --- .../src/acl/Configuration/ConfigureCenter.tsx | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/packages/core/client/src/acl/Configuration/ConfigureCenter.tsx b/packages/core/client/src/acl/Configuration/ConfigureCenter.tsx index aa3d102c9..69b102f86 100644 --- a/packages/core/client/src/acl/Configuration/ConfigureCenter.tsx +++ b/packages/core/client/src/acl/Configuration/ConfigureCenter.tsx @@ -1,7 +1,8 @@ import { Checkbox, message, Table } from 'antd'; -import React, { createContext, useContext, useState } from 'react'; +import React, { createContext, useContext } from 'react'; import { useTranslation } from 'react-i18next'; import { useAPIClient, useRequest } from '../../api-client'; +import { SettingsCenterContext } from '../../pm'; import { useRecord } from '../../record-provider'; import { useCompile } from '../../schema-component'; @@ -28,19 +29,8 @@ const getChildrenKeys = (data = [], arr = []) => { const SettingMenuContext = createContext(null); -function useGetContext() { - const [context, setContext] = useState(null); - import('../../pm').then(({ SettingsCenterContext }) => { - setContext(SettingsCenterContext); - }); - - return context; -} - export const SettingCenterProvider = (props) => { - const context = useGetContext(); - const configureItems = context && useContext(context); - + const configureItems = useContext(SettingsCenterContext); return {props.children}; };