0
or other falsy but non-nullish values being ignored for certain key
properties
#4111
Labels
0
or other falsy but non-nullish values being ignored for certain key
properties
#4111
Bug Report
Using falsy checks for keys in certain places means we're unable to use
0
(and possiblyfalse
,NaN
, etc.) as a key. In #1729 the resolution seemed to be to use nullish semantics, but at least a few components didn't get the memo:Semantic-UI-React/src/views/Feed/Feed.js
Line 37 in 694e399
Semantic-UI-React/src/views/Item/ItemGroup.js
Line 52 in 694e399
Semantic-UI-React/src/modules/Search/Search.js
Line 414 in 694e399
Semantic-UI-React/src/views/Card/CardGroup.js
Line 63 in c828368
I was going to open a PR fixing these cases to use Lodash's
isNil()
as elsewhere, however I was thinking now that the nullish coalescing operator (??
) is part of JS, maybe you guys would like to add the Babel plugin for it so we could use that instead? I notice that the optional chaining plugin is already there.Edit: I just realized that nullish coalescing is probably already available from preset-env.
Steps
e.g:
Expected Result
The generated
Item
s should have akey
of"0"
and"1"
respectively.Actual Result
The first item has a generated key based on its other props:
"Foo---"
Version
2.0.1
Testcase
Directly from one of the doc examples: https://codesandbox.io/s/tooji?module=/example.js
The text was updated successfully, but these errors were encountered: