mirror of
https://github.com/nocobase/nocobase
synced 2024-11-16 03:35:10 +00:00
refactor: extract
This commit is contained in:
parent
9a33216640
commit
c0e5dd2453
@ -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'];
|
||||
|
Loading…
Reference in New Issue
Block a user