Tencent / Tencent/tdesign-react
[Cascader] options 传入 相反的 value 选项时候,出现冲突,交互异常
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 965
- Forks
- 373
- Avg merge
- 3d 6h
- Merged PRs (30d)
- 17
Description
tdesign-react 版本
1.5.3 以上 应该一直有问题
重现链接
https://stackblitz.com/edit/jmcnsivb?file=src%2Fdemo.tsx
重现步骤
[
{
label: '选项一',
value: '1',
children: [
{
label: '子选项一',
value: '1.1',
},
{
label: '子选项二',
value: '1.2',
},
],
},
{
label: '子选项一',
value: '1.1',
children: [
{
label: '选项一',
value: '1',
},
],
},
]
这个 options 数组的结构,选项一是父级,子选项一是子级
同时存在一个 选项一是子级,子选项一是父级
这种情况下 交互异常,核心原因 valueType="full" 时,选出的数组 没有按序判断,只要存在 value 数组的值 都会被选中,忽略了父子级关系
期望结果
按父子级序,设定最终选中的值
实际结果
交互异常,组件选中值冲突
框架版本
No response
浏览器版本
No response
系统版本
No response
Node版本
No response
补充说明
级联组件应该有层级关系,这是组件的基本属性,如果选中值失去层级关系,这个意义在哪里?
基础问题,请尽快fix
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the StackBlitz reproduction in src/demo.tsx and inspect the Cascader handling for valueType="full". Reproduce the conflicting parent-child values, then verify that selection follows the option hierarchy and that the resulting selected values no longer conflict.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100