ant-design tagRender in select component (in tags mode) is invoked regardless of whether values are present or not

jjjwad0x  于 22天前  发布在  其他
关注(0)|答案(3)|浏览(15)

Steps to reproduce

Render a select in tags mode with a custom tagRender property which throws if value is undefined.

What is expected?

I expected tagRender only to be invoked if value is defined (i. e. a valid string)

What is actually happening?

tagRender prop is being invoked even if there is no value present (with value being set to undefined)
| Environment | Info |
| ------------ | ------------ |
| antd | 5.15.2 |
| React | 18.2.0 |
| System | linux |
| Browser | chrome |

The issue was introduced with antd 5.15.2 which in turn was caused by the update of rc-select to version 14.12.1 to 14.13.0 which in turn just bumped up the version of rc-trigger from 1.5.0 to 2.0.0.

vtwuwzda

vtwuwzda3#

It's this part btw, that causes the issue: https://github.com/react-component/select/blob/ebc3f689eac9640534026fb3349e901dd55bdab6/src/Selector/MultipleSelector.tsx#L179

customizeRenderSelector(undefined, content, false, false, undefined, true)

相关问题