-
-
Notifications
You must be signed in to change notification settings - Fork 53.5k
Closed
Labels
good first issuehelp wantedThe suggestion or request has been accepted, we need you to help us by sending a pull request.The suggestion or request has been accepted, we need you to help us by sending a pull request.
Description
Reproduction link
ant-design/components/button/button.tsx
Line 193 in a2c7ea4
typeof loading === 'object' && loading.delay ? loading.delay || true : !!loading; |
Steps to reproduce
<Button loading={null}></Button>
What is expected?
由于某个变量作为loading传入,有时候它可能为null, 希望它跟传入为false一样
What is actually happening?
实际上传入为null时,会直接报错
Environment | Info |
---|---|
antd | 4.20.2 |
React | 16.12.0 |
System | mac |
Browser | chrome 102 |
希望将源码中 typeof loading === 'object' 改为 Object.prototype.toString.call(loading)
这样即便为null也不会报错了
这样会报错的场景组件本身就应该要规避,无论传进什么参数都不至于报错造成页面直接奔溃
Metadata
Metadata
Assignees
Labels
good first issuehelp wantedThe suggestion or request has been accepted, we need you to help us by sending a pull request.The suggestion or request has been accepted, we need you to help us by sending a pull request.