From d427dc6ea112df29fbf7c5f31b8e6c4249917326 Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Thu, 7 Mar 2024 08:37:49 +0800 Subject: [PATCH] fix: avoid crashing --- .../@nocobase/plugin-snapshot-field/src/client/interface.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/plugins/@nocobase/plugin-snapshot-field/src/client/interface.ts b/packages/plugins/@nocobase/plugin-snapshot-field/src/client/interface.ts index 8013a5632..3ca795cde 100644 --- a/packages/plugins/@nocobase/plugin-snapshot-field/src/client/interface.ts +++ b/packages/plugins/@nocobase/plugin-snapshot-field/src/client/interface.ts @@ -17,7 +17,7 @@ const TARGET_FIELD = 'targetField'; export const useTopRecord = () => { let record = useRecord(); - while (record && Object.keys(record.__parent).length > 0) { + while (record?.__parent && Object.keys(record.__parent).length > 0) { record = record.__parent; } return record;