-
Notifications
You must be signed in to change notification settings - Fork 75
new(DataTable): Add xLarge row size. Fix forceUpdate logic. #367
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
Size Changes
View raw build statsPrevious (master){
"apollo": {
"esm": 10832,
"lib": 14147
},
"app-shell": {
"esm": 12906,
"lib": 19874
},
"composer": {
"esm": 68247,
"lib": 101805
},
"core": {
"esm": 576067,
"lib": 721289
},
"forms": {
"esm": 36180,
"lib": 48408
},
"icons": {
"esm": 156355,
"lib": 205626
},
"layouts": {
"esm": 15298,
"lib": 20770
},
"metrics": {
"esm": 5467,
"lib": 7729
},
"test-utils": {
"esm": 4279,
"lib": 5937
}
}Current{
"apollo": {
"esm": 10832,
"lib": 14147
},
"app-shell": {
"esm": 12906,
"lib": 19874
},
"composer": {
"esm": 68247,
"lib": 101805
},
"core": {
"esm": 576205,
"lib": 721427
},
"forms": {
"esm": 36180,
"lib": 48408
},
"icons": {
"esm": 156355,
"lib": 205626
},
"layouts": {
"esm": 15298,
"lib": 20770
},
"metrics": {
"esm": 5467,
"lib": 7729
},
"test-utils": {
"esm": 4279,
"lib": 5937
}
} |
| const { sortBy, sortDirection } = this.state; | ||
| const dimensionsChanged = width !== prevProps.width || height !== prevProps.height; | ||
| const sortChanged = | ||
| sortBy !== prevState.sortBy || |
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.
we already invoke this.cache.clearAll(); when updating sortBy or sortByDirection, so this was doing a double update
5c74d88 to
1376e36
Compare
|
|
||
| type HeightMap = { | ||
| [key: string]: number; | ||
| [key in RowHeightOptions]: number; |
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.
nice
| if (dynamicRowHeight) { | ||
| // We need to make sure the cache is cleared before React tries to re-render. | ||
| window.setTimeout(() => { | ||
| if (this.timeoutId) window.clearTimeout(this.timeoutId); |
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.
If a timer is already set, shouldn't that one just run instead of clearing and creating a new one?
| export type DataTableRef = (instance: DataTable) => void; | ||
| export type TableRef = React.RefObject<Table>; | ||
| export type RowHeightOptions = string; | ||
| export type RowHeightOptions = 'micro' | 'small' | 'regular' | 'large' | 'xLarge' | 'jumbo'; |
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.
Lets just call it xlarge for consistency.
to: @milesj @stefhatcher @hayes @alecklandgraf
cc @schillerk
Description
This PR
DataTable:xLargerowHeighttype fromstringto a union of possiblestringforceUpdatecalls incomponentDidUpdateMotivation and Context
I've been trying to upgrade to lunar v3 and some of our tables are pretty broken, especially for dynamic row height. Adding an additional fixed row height will alleviate some of these issues for us, and I'm hoping the
forceUpdatelogic may help. I'm not sure if there have been regressions, but it's pretty easy to generate a stack trace in the storybook now. Go here, expand the row, then sort a column 😱I couldn't think of a great way to remove the force updates, but I tried to clean it up a bit. You can still get the stack trace from resizing the window many times, unfortunately the
AutoSizerdoesn't support adebounceproperty 😢Testing
xLargerow height renders as expectedScreenshots
xLarge (no story changes)

Checklist