-
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(tracehouse): allow missing FCP #9174
Conversation
@@ -43,7 +43,8 @@ class TraceOfTab { | |||
* @return {Promise<LH.Artifacts.TraceOfTab>} | |||
*/ | |||
static async compute_(trace) { | |||
return LHTraceProcessor.computeTraceOfTab(trace); | |||
const traceOfTab = await LHTraceProcessor.computeTraceOfTab(trace, {throwOnNoFCP: true}); | |||
return /** @type {LH.Artifacts.TraceOfTab} */ (traceOfTab); |
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.
I really don't like this, but I was blanking on a way to do this without casting and/or manually reconstructing the entire object.
any ideas @brendankenny ?
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 if we didn't throw in trace-processor.js
at all and only throw NO_FCP
out here if it's not on the return value?
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.
doesn't that involve manually reconstructing every object that has fcp?
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.
doesn't that involve manually reconstructing every object that has fcp?
yeah, I can't think of a way around it, tsc won't track the validations on all three existence checks into the return value :/
It would allow simplifying trace-processor.js
(no argument, no fcp check in there, etc), though, and it would keep the fcp checks and cast in the same place in this file.
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.
yeah, ended up not being so bad I guess. done!
ping 🏓 |
because the computed artifact already has a test for this? (I mean for overall testing, obviously the |
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! last nits but LGTM
@@ -16,6 +16,9 @@ | |||
* 4. Return all those items in one handy bundle. | |||
*/ | |||
|
|||
/** @typedef {Omit<LH.Artifacts.TraceTimes, 'firstContentfulPaint'> & {firstContentfulPaint?: number}} TraceTimesWithoutFCP */ | |||
/** @typedef {Omit<LH.Artifacts.TraceOfTab, 'firstContentfulPaintEvt'|'timings'|'timestamps'> & {timings: TraceTimesWithoutFCP, timestamps: TraceTimesWithoutFCP, firstContentfulPaintEvt?: LH.Artifacts.TraceOfTab['firstContentfulPaintEvt']}} TraceOfTabWithoutFCP */ |
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.
these types seem kind of terrible for downstream users, but I guess we can iterate on it in the future :)
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.
heh, yeah there will be lots of interesting problems to solve when we expose these types :)
firstContentfulPaintEvt, | ||
timings: {...timings, firstContentfulPaint: firstContentfulPaintTiming}, | ||
timestamps: {...timestamps, firstContentfulPaint: firstContentfulPaintTs}, | ||
}; |
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.
ha, I don't entirely trust tsc with object spreading + composition, but any change I make here gives the right error, so good job compiler! (and @patrickhulce)
Yes, that commit just removed the test from |
Summary
One of the only changes made to tracium that needs to be ported back, part of the larger plan specified in #8956.
Related Issues/PRs
#8956