Skip to content

[TagInput] Cannot read properties of undefined (reading 'length') #4247

@weihao521

Description

@weihao521

tdesign-react 版本

1.16.2

重现链接

https://codesandbox.io/p/sandbox/tdesign-react-demo-forked-44sr5f?file=%2Fsrc%2Fdemo.tsx%3A49%2C21

重现步骤

当TagInput组件受控于FormItem时,且FormItem被渲染在FormList中时,TagInput就会抛出 Uncaught TypeError: Cannot read properties of undefined (reading 'length'),此时需要手动给FormItem设置初始值;而如果FormItem不放在FormList中,则有无初始值都运行正常。结构如下:{() => {return (<>{isShow ? () : null}</>);}}

期望结果

TagInput受控于FormItem时,无论FormItem是否在FormList中,都应正常运行。

实际结果

TagInput组件内部抛出错误, Uncaught TypeError: Cannot read properties of undefined (reading 'length')

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    🐞 bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions