From 0318034b7c9c8d302045a73be1f31f2c1a619a13 Mon Sep 17 00:00:00 2001 From: katherinehhh Date: Tue, 23 May 2023 09:44:17 +0800 Subject: [PATCH] fix: updateAssociationValues (#1903) --- .../core/client/src/block-provider/hooks/index.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts index d8b0bdbf4..6bceb259d 100644 --- a/packages/core/client/src/block-provider/hooks/index.ts +++ b/packages/core/client/src/block-provider/hooks/index.ts @@ -1176,12 +1176,17 @@ export const useAssociationNames = (collection) => { if (schema) { const associations = getAssociationAppends(schema); const appends = flattenNestedList(associations); - console.log(appends, associations); - return { appends, updateAssociationValues: appends.filter((v) => associationValues.includes(v)) }; + return { + appends, + updateAssociationValues: appends.filter((item) => associationValues.some((suffix) => item.endsWith(suffix))), + }; } if (!schema) { const associations = getAssociationAppends(formSchema); const appends = flattenNestedList(associations); - return { appends, updateAssociationValues: appends.filter((v) => associationValues.includes(v)) }; + return { + appends, + updateAssociationValues: appends.filter((item) => associationValues.some((suffix) => item.endsWith(suffix))), + }; } };