alibaba-fusion / next

🦍 A configurable component library for web built on React.
https://fusion.design
MIT License
4.56k stars 577 forks source link

[Field]unmount custom function component but value in field still exists #4875

Open ilovejcm opened 1 week ago

ilovejcm commented 1 week ago

Component

Field

Reproduction link

https://hitu.antgroup-inc.cn/codeblocks/8b97b84a

Steps to reproduce

Expect: auto clear value in field when custom function component has been unmounted just like other fusion components dose

github-actions[bot] commented 1 week ago

这是您为 Fusion/Next 提的第一个 issue,感谢您对 Fusion 的信任和支持,我们会尽快进行处理。

FairyYang commented 5 days ago

因为自定义组件是函数式组件,没有ref,造成field 无法跟进组件状态。提供一种解决方案,将函数式组件包裹forwardRef,示例:https://hitu.antgroup-inc.cn/codeblocks/7b3abf8b