select
select copied to clipboard
antd v5: Controlled components will treat `null` as empty value and `null` can not be used as an option value.
Changes:
nullcannot be used as an option value.allowCleartriggerChange will pass thenullto onChange() instead ofundefined.- add a new example:
null-controlledexample. (placeholder will show up) - change some test case for
nullas an option value. - add
prettierlatest (2.x) version to devDependencies, because the current prettier version added by umi-utils is 1.x, which can't deal with typescirpt import type syntax (prettier 1.x error: SyntaxError: '=' expected). - add node children & options
nullvalue wanrning (/utils/warningPropsUtils.ts).
Chinese (中文):
null不能作为选项的 value 了。allowClear触发清空更新会传递null作为空值而不是undefined。- 新增了一个
null作为 value 初始值的例子(占位符会正确出现,移除了之前的特殊处理逻辑)。 - 修改了
null不能作为 value 相关的几个测试用例。 - 添加了
prettier的最新版本(2.x)到 devDependencies,因为当前由 umi-utils 安装的的 prettier 版本是 1.x, 不能正确处理 typescript 的 import type 语法(prettier 1.x 会报错:SyntaxError: '=' expected)。 - 添加了
null作为 value 出现在 options 中的告警(在 /utils/warningPropsUtils.ts 中)。
The latest updates on your projects. Learn more about Vercel for Git ↗︎
| Name | Status | Preview | Updated |
|---|---|---|---|
| select | ✅ Ready (Inspect) | Visit Preview | Jun 14, 2022 at 11:47AM (UTC) |
Codecov Report
Merging #777 (007c0f0) into master (446dd09) will increase coverage by
0.00%. The diff coverage is100.00%.
:exclamation: Current head 007c0f0 differs from pull request most recent head ecf8223. Consider uploading reports for the commit ecf8223 to get more accurate results
@@ Coverage Diff @@
## master #777 +/- ##
=======================================
Coverage 99.50% 99.51%
=======================================
Files 25 25
Lines 1020 1029 +9
Branches 341 337 -4
=======================================
+ Hits 1015 1024 +9
Misses 4 4
Partials 1 1
| Impacted Files | Coverage Δ | |
|---|---|---|
| src/Select.tsx | 100.00% <100.00%> (ø) |
|
| src/utils/warningPropsUtil.ts | 98.59% <100.00%> (+0.28%) |
:arrow_up: |
| src/Selector/Input.tsx | 100.00% <0.00%> (ø) |
|
| src/Selector/index.tsx | 100.00% <0.00%> (ø) |
:mega: Codecov can now indicate which changes are the most critical in Pull Requests. Learn more
先到 FAQ 里 PR 一下,说明一下 null 值在 antd 中的定义,以及为什么要这么做哈~
这是 break change,至少 4.x 中不能改。
嗯嗯,这应该是 V5 的 break change。4.x 我先写个 FAQ:null & undefined controlled components 的PR,然后再在这里提个 null warning 的 PR 上来先哇