-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
report: consolidate table headers #14315
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.
One request for a prepareReportResult test, but otherwise LGTM. Yay very slow but eventual progress! :)
/** | ||
* The data format of the column of values being described. Usually | ||
* those values will be primitives rendered as this type, but the values | ||
* could also be objects with their own type to override this field. | ||
*/ | ||
itemType: ItemValueType; | ||
valueType: ItemValueType; |
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.
complete tangent to this change, but I feel like there was a good reason table rows are called items
but I really don't remember it
*/ | ||
subItemsHeading?: {key: string, valueType?: ItemValueType, displayUnit?: string, granularity?: number}; | ||
|
||
// NOTE: not used by opportunity details, but used in the renderer until table/opportunity unification. |
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.
What happens with these now? Do opportunities get a default granularity that matches their old ones now that they're tables?
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 like nothing changes here.
I don't understand the comment though. comes from #7177 . Is it just saying that no audit that makes an opportunity
tables bothers to set granularity/displayUnit? Probably true when written, but now there's at least one (first byte efficiency audit I looked at uses them, duplicated-javascript
).
Regardless, same things happens as before with opportunity tables–if granularity/displayUnit is not defined, details-renderer.js
various defaults are used instead.
report/renderer/details-renderer.js
Outdated
/** | ||
* @param {Exclude<LH.Audit.Details.TableColumnHeading['subItemsHeading'], undefined>} subItemsHeading | ||
* @param {LH.Audit.Details.TableColumnHeading} parentHeading | ||
* @return {LH.Audit.Details.OpportunityColumnHeading['subItemsHeading']} | ||
* @return {LH.Audit.Details.TableColumnHeading['subItemsHeading']} | ||
*/ | ||
_getCanonicalizedsubItemsHeading(subItemsHeading, parentHeading) { |
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.
this can go too (how important is the falsy key check?)
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.
ehhh I think only I wanted that line added, and today I don't really see the point. A new audit would surely notice a bad key being referenced during development. so just drop.
Fixes #13803
Shouldn't be any surprises here. I pretty much took what @brendankenny did here. Also add some comapt code in
prepareReportResult
.