-
Notifications
You must be signed in to change notification settings - Fork 377
fix(Dropdown): Set a random id for dropdown item if id is not given #3555
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
PatternFly-React preview: https://patternfly-react-pr-3555.surge.sh |
Codecov Report
@@ Coverage Diff @@
## master #3555 +/- ##
=======================================
Coverage 67.11% 67.11%
=======================================
Files 903 903
Lines 25502 25502
Branches 2262 2262
=======================================
Hits 17115 17115
Misses 7346 7346
Partials 1041 1041
Continue to review full report at Codecov.
|
|
Could we simply not set the id if not given? So either remove the default props for
|
|
@jeff-phillips-18 - yes, that makes more sense. Thanks for the feedback. |
packages/patternfly-4/react-core/src/components/Dropdown/InternalDropdownItem.tsx
Outdated
Show resolved
Hide resolved
jeff-phillips-18
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks.
| id: '', | ||
| componentID: '', | ||
| id: null, | ||
| componentID: null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of setting this to null, couldn't we just not set a default? That is, remove this from defaultProps.
We shouldn't need to test componentID || undefined because it would already be undefined.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
that was my thought as well, but if i recall the lint settings require optional props to have defaults, though undefined may be a valid default 🤷♂
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah if you remove the default props here then it will just default to undefined and be fine.
dlabaj
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you update this to no set a default for id and componentID, then you won't need the checks like dan suggested. Also title seems wrong for this PR seems. Thanks.
Signed-off-by: Boaz Shuster <boaz.shuster.github@gmail.com>
dlabrecq
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
jeff-phillips-18
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 Glad we got rid of the default value lint checks!
What: Closes #3549
//cc @jeff-phillips-18