fix: fix the issue where oho field block does not request data (#6125)

This commit is contained in:
Zeke Zhang 2025-01-23 12:23:15 +08:00 committed by GitHub
parent 049b2a542f
commit 76c826150b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -19,6 +19,7 @@ import {
DataBlockProvider,
TableFieldResource,
WithoutTableFieldResource,
useCollectionManager,
useCollectionParentRecord,
useCollectionRecord,
useCollectionRecordData,
@ -294,10 +295,10 @@ export const useFilterByTk = (blockProps?: any) => {
const recordIndex = useRecordIndex();
const recordData = useCollectionRecordData();
const collection = useCollection_deprecated();
const { getCollectionField } = useCollectionManager_deprecated();
const association = useBlockAssociationContext();
const assoc = blockProps?.association || association;
const withoutTableFieldResource = useContext(WithoutTableFieldResource);
const cm = useCollectionManager();
if (!withoutTableFieldResource) {
if (resource instanceof TableFieldResource || __parent?.block === 'TableField') {
@ -306,8 +307,8 @@ export const useFilterByTk = (blockProps?: any) => {
}
if (assoc) {
const association = getCollectionField(assoc);
return recordData?.[association.targetKey || 'id'];
const association = cm.getCollectionField(assoc);
return recordData?.[association.targetKey || association.sourceKey || 'id'];
}
if (isArray(collection.filterTargetKey)) {
const filterByTk = {};