-
Notifications
You must be signed in to change notification settings - Fork 841
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
fix(EuiBasicTable): fixed EuiBasicTable proptypes of itemId #3133
Conversation
Since this is a community submitted pull request, a Jenkins build has not been kicked off automatically. Can an Elastic organization member please verify the contents of this patch and then kick off a build manually? |
Jenkins test this |
Preview documentation changes for this PR: https://eui.elastic.co/pr_3133/ |
@pranshuchittora Can you describe how you found the issue to be that |
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.
The root case here is the re-use of ItemId<T>
type for both EuiBasicTable
's itemId and CollapsedItemActions
's itemId. This was an oversight during these components' translation to TypeScript.
EuiBasicTable
uses its itemId
to know what field on an object is its ID, thus the string | ((item: T) => string)
definition. However, CollapsedItemActions
's itemId
is the resolved value (either a string or a number are valid, thus the change).
The proper way to fix this is to re-define CollapsedItemAction
's itemId
as string | number
, not ItemId<T>
. expanded_item_actions.tsx should be updated similarly.
Why the
|
It needs the generic type because, when it is a function, it is passed the item as its argument. For the tables, the item type is represented by the generic. The code using
|
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.
Looks good, but needs to make the same changes to src/components/basic_table/expanded_item_actions.tsx
chore(CHANGELOG): updated the changelog docs(EuiBasicTable): updated propTypes
@chandlerprall please review the new changes :) |
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.
Changes LGTM; Pulled & tested locally. I also merged in master to correct the changelog entry placement (releases often screw up open PR changelogs)
Thanks for the bugfix @pranshuchittora ! |
Summary
Closes #3130
Summarize your PR. If it includes design elements include a screenshot or gif.
As of now, I have added a type the propTypes of ItemId (
number
).Another approach is that I can convert the given input to String.
Checklist