Skip to content

Commit

Permalink
fix: 修复 formList 嵌套数据获取异常 (#2529)
Browse files Browse the repository at this point in the history
  • Loading branch information
honkinglin authored Sep 28, 2023
1 parent e139f96 commit 7e76f57
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
4 changes: 1 addition & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,7 @@ spline: explain
- `steps`: 全局配置添加步骤条的已完成图标自定义 @Zzongke ([#2491](https://github.com/Tencent/tdesign-react/pull/2491))
- `Table`: 可筛选表格,`onFilterChange` 事件新增参数 `trigger: 'filter-change' | 'confirm' | 'reset' | 'clear'`,表示触发筛选条件变化的来源 @chaishi ([#2492](https://github.com/Tencent/tdesign-react/pull/2492))
- `Form`: trigger新增`submit`选项 @honkinglin ([#2507](https://github.com/Tencent/tdesign-react/pull/2507))
- `ImageViewer`:
- `onIndexChange` 事件新增 `trigger` 枚举值 `current` @chaishi ([#2494](https://github.com/Tencent/tdesign-react/pull/2494))
-
- `ImageViewer`: `onIndexChange` 事件新增 `trigger` 枚举值 `current` @chaishi ([#2494](https://github.com/Tencent/tdesign-react/pull/2494))
- `Image`:
- 新增 `fallback`,表示图片的兜底图,原始图片加载失败时会显示兜底图 @chaishi ([#2494](https://github.com/Tencent/tdesign-react/pull/2494))
- 新增支持 `src` 类型为 `File`,支持通过 `File` 预览图片 @chaishi ([#2494](https://github.com/Tencent/tdesign-react/pull/2494))
Expand Down
3 changes: 2 additions & 1 deletion src/form/hooks/useInstance.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,8 @@ export default function useInstance(props: TdFormProps, formRef, formMapRef: Rea
const fieldsValue = {};

if (nameList === true) {
for (const [name, formItemRef] of formMapRef.current.entries()) {
// 嵌套数组子节点先添加导致外层数据覆盖因而需要倒序遍历
for (const [name, formItemRef] of [...formMapRef.current.entries()].reverse()) {
const fieldValue = calcFieldValue(name, formItemRef?.current.getValue?.());
merge(fieldsValue, fieldValue);
}
Expand Down

0 comments on commit 7e76f57

Please sign in to comment.