-
Notifications
You must be signed in to change notification settings - Fork 687
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Changed prop type of uniqueID for Item component. #1586
Conversation
@@ -54,7 +54,8 @@ Item.propTypes = { | |||
item: PropTypes.any.isRequired, | |||
itemIndex: PropTypes.number.isRequired, | |||
render: PropTypes.oneOfType([PropTypes.func, PropTypes.string]).isRequired, | |||
uniqueID: PropTypes.number | |||
uniqueID: PropTypes.oneOfType([PropTypes.number, PropTypes.string]) |
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.
Are the uses of uniqueID
within this component capable of handling either?
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.
I think this uses a set downstream which means we need to make sure to use a single type.
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.
Yes, we just use it as key for a component. Since react does not allow users to send a prop called key to its children, I am just passing it down as uniqueID. Once it reaches the Item
component, it is used as key
which can be number
or string
.
|
Thanks for fixing this :) |
Description
uniqueID prop check was failing since it was mentioned that uniqueID will be a number but in case of
category
component which internally usesitem
, it can be a string as well.So no more errors like this:
Related Issue
None. No issue for this. It is just a dev fix.
Closes nothing.
Verification Steps
No more console errors related to prop types.
Checklist
Check the console for prop types errors in category and product pages.