fix: avoid crashing

This commit is contained in:
Zeke Zhang 2024-03-07 08:37:49 +08:00
parent 0f1115b058
commit d427dc6ea1

View File

@ -17,7 +17,7 @@ const TARGET_FIELD = 'targetField';
export const useTopRecord = () => { export const useTopRecord = () => {
let record = useRecord(); let record = useRecord();
while (record && Object.keys(record.__parent).length > 0) { while (record?.__parent && Object.keys(record.__parent).length > 0) {
record = record.__parent; record = record.__parent;
} }
return record; return record;