-
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
core(trace-elements): remove element score field #15677
Conversation
3cacae3
to
3b9548c
Compare
{nodeId: 13, score: 0.1}, | ||
{nodeId: 14, score: 0.1}, | ||
{nodeId: 15, score: 0.1}, | ||
{nodeId: 3}, // score: 1.0 |
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.
did you mean to keep?
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.
No, score isn't on the trace elements anymore. This was just a way for the test to justify the order given.
@@ -43,12 +43,12 @@ class LayoutShiftElements extends Audit { | |||
const {cumulativeLayoutShift: clsSavings, impactByNodeId} = | |||
await CumulativeLayoutShiftComputed.request(artifacts.traces[Audit.DEFAULT_PASS], context); | |||
|
|||
/** @type {Array<{node: LH.Audit.Details.ItemValue, score?: number}>} */ | |||
/** @type {Array<{node: LH.Audit.Details.ItemValue, score: 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.
does this refactor mean the impactByNodeId map should always have a value, and so || 0
was done to placate typescript? or are we setting 0 where before it would be undefined?
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.
It's kinda both. Every LS element that appears in TraceElements
should also appear in impactByNodeId
. I'm not aware of any situation where the || 0
would get triggered, but if it does the previous behavior would have been to leave as undefined.
Follow up to #15593
With
impactByNodeId
on the CLS computed artifact, we don't need the trace elementsscore
field anymore.