fix(CollectionManagerSchemaComponentProvider): fix incorrect scope value

This commit is contained in:
Zeke Zhang 2024-11-13 13:26:46 +08:00
parent da8b43d932
commit e4d1242e84

View File

@ -7,14 +7,13 @@
* For more information, please refer to: https://www.nocobase.com/agreement. * For more information, please refer to: https://www.nocobase.com/agreement.
*/ */
import React from 'react'; import React, { useMemo } from 'react';
import { SchemaComponentOptions } from '..'; import { SchemaComponentOptions } from '..';
import { CollectionProvider_deprecated } from './CollectionProvider_deprecated'; import { CollectionProvider_deprecated } from './CollectionProvider_deprecated';
import { ResourceActionProvider, useDataSourceFromRAC } from './ResourceActionProvider'; import { ResourceActionProvider, useDataSourceFromRAC } from './ResourceActionProvider';
import * as hooks from './action-hooks'; import * as hooks from './action-hooks';
import { DataSourceProvider_deprecated, SubFieldDataSourceProvider_deprecated, ds } from './sub-table'; import { DataSourceProvider_deprecated, SubFieldDataSourceProvider_deprecated, ds } from './sub-table';
const scope = { cm: { ...hooks, useDataSourceFromRAC }, ds };
const components = { const components = {
SubFieldDataSourceProvider_deprecated, SubFieldDataSourceProvider_deprecated,
DataSourceProvider_deprecated, DataSourceProvider_deprecated,
@ -23,6 +22,7 @@ const components = {
}; };
export const CollectionManagerSchemaComponentProvider: React.FC = (props) => { export const CollectionManagerSchemaComponentProvider: React.FC = (props) => {
const scope = useMemo(() => ({ cm: { ...hooks, useDataSourceFromRAC }, ds }), []);
return ( return (
<SchemaComponentOptions scope={scope} components={components}> <SchemaComponentOptions scope={scope} components={components}>
{props.children} {props.children}