From 5d825f85bc2a31b1378508f5b28c618ddbd6c40a Mon Sep 17 00:00:00 2001 From: Zeke Zhang <958414905@qq.com> Date: Mon, 12 Aug 2024 10:16:15 +0800 Subject: [PATCH] fix(Collapse): fix issue with data scope settings being ineffective (#4914) * fix(Collapse): fix issue with data scope settings being ineffective * fix: fix 'Default collapse' and 'sort rules' --- packages/core/client/src/block-provider/hooks/index.ts | 8 +++++--- .../antd/association-filter/AssociationFilter.Item.tsx | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/core/client/src/block-provider/hooks/index.ts b/packages/core/client/src/block-provider/hooks/index.ts index 402dd83cde..bddc8f8a6a 100644 --- a/packages/core/client/src/block-provider/hooks/index.ts +++ b/packages/core/client/src/block-provider/hooks/index.ts @@ -1239,18 +1239,20 @@ export const useAssociationFilterBlockProps = () => { }, }, { - // 由于 选项字段不需要触发当前请求,所以当前请求更改为手动触发 + // 由于选项字段不需要触发当前请求,所以当前请求更改为手动触发 manual: true, debounceWait: 300, }, )); useEffect(() => { - // 由于 选项字段不需要触发当前请求,所以请求单独在 关系字段的时候触发 + // 由于选项字段不需要触发当前请求,所以请求单独在关系字段的时候触发 if (!isOptionalField(collectionField)) { run(); } - }, [collectionField, labelKey, run, valueKey]); + + // do not format the dependencies + }, [collectionField, labelKey, run, valueKey, field.componentProps?.params, field.componentProps?.params?.sort]); if (!collectionField) { return {}; diff --git a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.tsx b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.tsx index 4f2cb7a96b..097c858fc8 100644 --- a/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.tsx +++ b/packages/core/client/src/schema-component/antd/association-filter/AssociationFilter.Item.tsx @@ -48,7 +48,7 @@ export const AssociationFilterItem = withDynamicSchemaProps( const defaultActiveKeyCollapse = useMemo( () => (defaultCollapse && collectionField?.name ? [collectionField.name] : []), - [], + [collectionField.name, defaultCollapse], ); const valueKey = _valueKey || collectionField?.targetKey || 'id'; const labelKey = _labelKey || fieldSchema['x-component-props']?.fieldNames?.label || valueKey;