ant-design / ant-design/pro-components
🐛[ProFormDependency 当嵌套依赖的 value 为 0 时,会识别为 undefined]
- Dominant language
- TypeScript
- Stars
- 4.8k
- Forks
- 1.4k
- Avg merge
- 10h 44m
- Merged PRs (30d)
- 3
Description
### 🐛 bug 描述
ProFormDependency 当依赖的 value 为 0 时,会识别为 undefined,之前有个[同样的Issue](https://github.com/ant-design/pro-components/issues/4891)只解决了单个场景
当 `namepath` 为数组格式还是会有同样的问题,即 `value={item:[{value: 0}]}`
所以在 `get(value, itemName)` 同样需要加一下判断 `typeof get(value, itemName) !== 'undefined'`
https://github.com/ant-design/pro-components/blob/516987023cb426108c68bf40bee2db7922ef64bd/packages/form/src/components/Dependency/index.tsx#L86-L99
### 📷 复现步骤
### © 版本信息
- ProComponents 版本: ant-design/pro-components@2.8.10
- umi 版本
- 浏览器环境
- 开发环境 [e.g. mac OS]
Contributor guide
Research direction
Start in packages/form/src/components/Dependency/index.tsx around lines 86-99 and compare the handling with issue #4891. Trace the get(value, itemName) result for an array-form namepath containing value 0. Done means nested dependency values of 0 are retained rather than treated as undefined.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100