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
Table: upgrades react-table to 7.0.0 and typings #23247
Conversation
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! Great job @hugohaggmark!
@@ -57,6 +61,7 @@ export function getColumns(data: DataFrame, availableWidth: number, columnMinWid | |||
|
|||
columns.push({ | |||
Cell, | |||
id: field.name, |
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.
field name is not guaranteed to be unique sadly (A table can include multiple fields with same name). Can we use index instead?
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.
Great catch, I'll do that instead!
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.
So I tried several approaches, but no one worked.
- Adding index as id, react-table will replace the id with the Header name
- Using the accessor to retrieve the field failed too because it didn't match the correct memory area, got [object, object] instead of real values.
- Using the accessor to retrieve the index of field failed too for unknown reason, got strange values instead of real values.
So I settled with just using index from the loops, which seem to work for now when we don't have reordering of columns. I really don't like the react-table API because I'm just not getting it at all.
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 to me!
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!
What this PR does / why we need it:
Which issue(s) this PR fixes:
Relates #20709
Special notes for your reviewer: