Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Tree] 有重复节点时,表现异常 #1695

Closed
moecasts opened this issue Nov 9, 2022 · 3 comments · Fixed by #1698
Closed

[Tree] 有重复节点时,表现异常 #1695

moecasts opened this issue Nov 9, 2022 · 3 comments · Fixed by #1698

Comments

@moecasts
Copy link
Collaborator

moecasts commented Nov 9, 2022

tdesign-react 版本

0.42.6

重现链接

https://codesandbox.io/s/tdesign-react-demo-forked-vlnufb?file=/src/demo.jsx

重现步骤

当 tree 中有重复的节点时,表现奇怪。
eg:

  • 重复的节点没有展示完全,如上面的例子,duplicate 下的节点没了
  • 当 1.1, 1.2 都选中时,无法反选 1.1 (其他重复的节点也是如此)

期望结果

重复的节点也能显示,且切换选中状态正常。

实际结果

No response

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

业务场景:
人员选择器,一个人可以属于不同的组。

解决思路:
以 path 作为节点的 key,而不是 value。

@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2022

👋 @moecasts,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@github-actions
Copy link
Contributor

github-actions bot commented Nov 9, 2022

♥️ 有劳 @shryzhang @lysongzi @Ruoleery 尽快确认问题。
确认有效后将下一步计划和可能需要的时间回复给 @moecasts

@honkinglin
Copy link
Collaborator

目前tree内部维护唯一不同的key用的也是value字段,与外部业务理解的value不一样,需要通过keys 更改为别的字段并且提供一个不重复的key给到tree
可以暴露 treeRef 给到外部方便调用 tree 的能力

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants