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

[Form] 根据某个字段变化动态展示数据不支持上传组件 #3043

Closed
HeXavi8 opened this issue Aug 9, 2024 · 2 comments
Closed
Labels

Comments

@HeXavi8
Copy link

HeXavi8 commented Aug 9, 2024

tdesign-react 版本

1.7.9

重现链接

https://stackblitz.com/edit/react-m7ms5q?file=src%2Fdemo.tsx

重现步骤

在某些特定场景,修改某个字段值后更新新的字段选项,使用 shouldUpdate 修改 FormItem 的更新逻辑。
当子 FormItem 中组件的数据类型不同,数据变化之后,父FormItem无法切换,报错。
例如切换的子组件一个是 ColorPicker、一个是 Upload 的情况

未上传数据前可以切换
Screenshot 2024-08-10 at 02 37 24

Screenshot 2024-08-10 at 02 41 46
上传数据
Screenshot 2024-08-10 at 02 39 27
切换后报错
Screenshot 2024-08-10 at 02 40 32

期望结果

希望在某些特定场景,修改某个字段值后更新新的字段选项后,可以兼容不同数据类型的组件切换

实际结果

No response

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

Copy link
Contributor

github-actions bot commented Aug 9, 2024

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

@HaixingOoO
Copy link
Collaborator

你切换的时候给对应的FormItem不同的key来切换,要不React的渲染会认为是同一个元素,所以导致了这个问题
image

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

No branches or pull requests

3 participants