fix: graph collection current appInfo error (#2364)

This commit is contained in:
katherinehhh 2023-07-31 17:47:10 +08:00 committed by GitHub
parent 18bf6e507e
commit 07f1f16ea0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -375,9 +375,10 @@ export const GraphDrawPage = React.memo(() => {
const [collectionData, setCollectionData] = useState<any>([]); const [collectionData, setCollectionData] = useState<any>([]);
const [collectionList, setCollectionList] = useState<any>([]); const [collectionList, setCollectionList] = useState<any>([]);
const { refreshCM } = useCollectionManager(); const { refreshCM } = useCollectionManager();
const currentAppInfo = useCurrentAppInfo();
const { const {
data: { database }, data: { database },
} = useCurrentAppInfo(); } = currentAppInfo;
const categoryCtx = useContext(CollectionCategroriesContext); const categoryCtx = useContext(CollectionCategroriesContext);
const scope = { ...options?.scope }; const scope = { ...options?.scope };
const components = { ...options?.components }; const components = { ...options?.components };
@ -506,7 +507,7 @@ export const GraphDrawPage = React.memo(() => {
{ {
inherit: 'react-shape', inherit: 'react-shape',
component: (node) => ( component: (node) => (
<CurrentAppInfoContext.Provider value={database}> <CurrentAppInfoContext.Provider value={currentAppInfo}>
<APIClientProvider apiClient={api}> <APIClientProvider apiClient={api}>
<SchemaComponentOptions inherit scope={scope} components={components}> <SchemaComponentOptions inherit scope={scope} components={components}>
<CollectionCategroriesProvider {...categoryCtx}> <CollectionCategroriesProvider {...categoryCtx}>

View File

@ -186,6 +186,7 @@ const PortsCom = React.memo<any>(({ targetGraph, collectionData, setTargetNode,
const [collapse, setCollapse] = useState(false); const [collapse, setCollapse] = useState(false);
const { t } = useGCMTranslation(); const { t } = useGCMTranslation();
const compile = useCompile(); const compile = useCompile();
const { styles } = useStyles();
const { const {
data: { database }, data: { database },
} = useCurrentAppInfo(); } = useCurrentAppInfo();
@ -204,9 +205,7 @@ const PortsCom = React.memo<any>(({ targetGraph, collectionData, setTargetNode,
return `${prefix || ''}${uid()}`; return `${prefix || ''}${uid()}`;
}; };
const CollectionConten = (data) => { const CollectionConten = (data) => {
const { styles } = useStyles();
const { type, name, primaryKey, allowNull, autoIncrement } = data; const { type, name, primaryKey, allowNull, autoIncrement } = data;
return ( return (
<div className={styles.collectionPopoverClass}> <div className={styles.collectionPopoverClass}>
<div className="field-content"> <div className="field-content">