diff --git a/packages/core/client/src/data-source/collection/AssociationProvider.tsx b/packages/core/client/src/data-source/collection/AssociationProvider.tsx index 749a8d9f55..e3c2ae183c 100644 --- a/packages/core/client/src/data-source/collection/AssociationProvider.tsx +++ b/packages/core/client/src/data-source/collection/AssociationProvider.tsx @@ -1,8 +1,9 @@ -import React, { FC, ReactNode } from 'react'; -import { useCollectionManagerV2 } from './CollectionManagerProvider'; -import { CollectionDeletedPlaceholder } from '../components/CollectionDeletedPlaceholder'; -import { CollectionProviderV2 } from './CollectionProvider'; +import React, { FC, ReactNode, createContext, useContext } from 'react'; import { CollectionFieldProviderV2 } from '../collection-field'; +import { CollectionDeletedPlaceholder } from '../components/CollectionDeletedPlaceholder'; +import { CollectionV2 } from './Collection'; +import { useCollectionManagerV2 } from './CollectionManagerProvider'; +import { CollectionProviderV2, useCollectionV2 } from './CollectionProvider'; export interface AssociationProviderPropsV2 { dataSource?: string; @@ -10,6 +11,17 @@ export interface AssociationProviderPropsV2 { children?: ReactNode; } +const ParentCollectionContext = createContext(null); + +const ParentCollectionProvider = (props) => { + const collection = useCollectionV2(); + return {props.children}; +}; + +export const useParentCollection = () => { + return useContext(ParentCollectionContext); +}; + export const AssociationProviderV2: FC = (props) => { const { name, children } = props; @@ -20,9 +32,11 @@ export const AssociationProviderV2: FC = (props) => return ( - - {children} - + + + {children} + + ); };