diff --git a/packages/core/client/src/collection-manager/CollectionProvider.tsx b/packages/core/client/src/collection-manager/CollectionProvider.tsx
index da43550d18..7ee7bb9f5f 100644
--- a/packages/core/client/src/collection-manager/CollectionProvider.tsx
+++ b/packages/core/client/src/collection-manager/CollectionProvider.tsx
@@ -20,17 +20,18 @@ export const CollectionProvider: FC<{
const collectionName = getCollectionName(name || collection);
const cm = useCollectionManagerV2();
const hasCollection = cm.getCollection(collectionName);
- if (hasCollection || allowNull)
+ if (hasCollection || (allowNull && !collection))
return (
{children}
);
- if (typeof collection === 'object')
+ if (typeof collection === 'object') {
return (
{children}
);
+ }
return ;
};
diff --git a/packages/core/client/src/collection-manager/Configuration/schemas/collections.ts b/packages/core/client/src/collection-manager/Configuration/schemas/collections.ts
index 72f6ec0da2..211ad93ab9 100644
--- a/packages/core/client/src/collection-manager/Configuration/schemas/collections.ts
+++ b/packages/core/client/src/collection-manager/Configuration/schemas/collections.ts
@@ -4,15 +4,15 @@ import { message } from 'antd';
import { useTranslation } from 'react-i18next';
import { useAPIClient } from '../../../api-client';
import { i18n } from '../../../i18n';
-import { CollectionOptions } from '../../types';
import { CollectionCategory } from '../components/CollectionCategory';
import { CollectionTemplate } from '../components/CollectionTemplate';
+import { CollectionOptionsV2 } from '../../../application';
const compile = (source) => {
return Schema.compile(source, { t: i18n.t });
};
-export const collection: CollectionOptions = {
+export const collection: CollectionOptionsV2 = {
name: 'collections',
filterTargetKey: 'name',
targetKey: 'name',
diff --git a/packages/core/client/src/collection-manager/collectionPlugin.ts b/packages/core/client/src/collection-manager/collectionPlugin.ts
index ec1e387ace..a6a2273a68 100644
--- a/packages/core/client/src/collection-manager/collectionPlugin.ts
+++ b/packages/core/client/src/collection-manager/collectionPlugin.ts
@@ -41,6 +41,7 @@ import { InheritanceCollectionMixin } from './mixins/InheritanceCollectionMixin'
// import { general, expression, sql, tree, view } from './templates';
import { interfaces } from './Configuration/interfaces';
import { collectionTemplates } from './Configuration/templates';
+import { collection } from './Configuration/schemas/collections';
export class CollectionPlugin extends Plugin {
async load() {
@@ -114,6 +115,6 @@ export class CollectionPlugin extends Plugin {
},
});
- return service?.data?.data || [];
+ return [...(service?.data?.data || []), collection];
}
}