From b8406d843695792e237cb9a1d366d0715a8b9f63 Mon Sep 17 00:00:00 2001 From: lyx <2027667395@qq.com> Date: Mon, 1 Apr 2024 11:28:38 +0800 Subject: [PATCH] feat: git revert 005b5a313dee5f73010225e906b307fe05912388 --- .../data-block/DataBlockRequestProvider.tsx | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx b/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx index 9af56e19b..c8d361d61 100644 --- a/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx +++ b/packages/core/client/src/data-source/data-block/DataBlockRequestProvider.tsx @@ -7,7 +7,6 @@ import { AllDataBlockProps, useDataBlockProps } from './DataBlockProvider'; import { useDataBlockResource } from './DataBlockResourceProvider'; import { useDataSourceHeaders } from '../utils'; import { useDataLoadingMode } from '../../modules/blocks/data-blocks/details-multi/setDataLoadingModeSettingsItem'; -import { useCollection, useCollectionManager } from '../collection'; export const BlockRequestContext = createContext>(null); BlockRequestContext.displayName = 'BlockRequestContext'; @@ -56,7 +55,6 @@ function useCurrentRequest(options: Omit) { function useParentRequest(options: Omit) { const { sourceId, association, parentRecord } = options; const api = useAPIClient(); - const cm = useCollectionManager(); const dataBlockProps = useDataBlockProps(); const headers = useDataSourceHeaders(dataBlockProps.dataSource); return useRequest( @@ -65,12 +63,8 @@ function useParentRequest(options: Omit) { if (!association) return Promise.resolve({ data: undefined }); // "association": "Collection.Field" const arr = association.split('.'); - const field = cm.getCollectionField(association); - const isM2O = field.interface === 'm2o'; - const filterTargetKey = cm.getCollection(arr[0]).getOption('filterTargetKey'); - const filterKey = isM2O ? filterTargetKey : field.sourceKey; - // :get?filter[filterKey]=sourceId - const url = `${arr[0]}:get?filter[${filterKey}]=${sourceId}`; + // :get/ + const url = `${arr[0]}:get/${sourceId}`; const res = await api.request({ url, headers }); return res.data; }, @@ -94,7 +88,6 @@ export const BlockRequestProvider: FC = ({ children }) => { requestOptions, requestService, } = props; - const currentRequest = useCurrentRequest<{ data: any }>({ action, sourceId,