refactor: extract

This commit is contained in:
Zeke Zhang 2024-01-21 15:08:53 +08:00
parent 9a33216640
commit c0e5dd2453

View File

@ -360,7 +360,7 @@ export const useFilterByTk = () => {
const record = useRecord();
const collection = useCollection();
const { getCollectionField } = useCollectionManager();
const assoc = useContext(BlockAssociationContext);
const assoc = useBlockAssociationContext();
const withoutTableFieldResource = useContext(WithoutTableFieldResource);
if (!withoutTableFieldResource) {
if (resource instanceof TableFieldResource || __parent?.block === 'TableField') {
@ -378,7 +378,7 @@ export const useFilterByTk = () => {
export const useSourceIdFromRecord = () => {
const record = useRecord();
const { getCollectionField } = useCollectionManager();
const assoc = useContext(BlockAssociationContext);
const assoc = useBlockAssociationContext();
if (assoc) {
const association = getCollectionField(assoc);
return record?.[association.sourceKey || 'id'];
@ -388,7 +388,7 @@ export const useSourceIdFromRecord = () => {
export const useSourceIdFromParentRecord = () => {
const record = useRecord();
const { getCollectionField } = useCollectionManager();
const assoc = useContext(BlockAssociationContext);
const assoc = useBlockAssociationContext();
if (assoc) {
const association = getCollectionField(assoc);
return record?.__parent?.[association.sourceKey || 'id'];