-
Notifications
You must be signed in to change notification settings - Fork 9.3k
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
refactor: makes non-finished network records available #2197
Conversation
Can you clarify "internally"? I don't see the significance |
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. Just updating surrounding comments, and for most of these, it probably makes sense to move the record.finished
check first as it's the more
(most?) fundamental differentiator for "this audit isn't for this kind of request"
@@ -61,7 +61,7 @@ class TotalByteWeight extends ByteEfficiencyAudit { | |||
let results = []; | |||
networkRecords.forEach(record => { | |||
// exclude data URIs since their size is reflected in other resources | |||
if (record.scheme === 'data') return; | |||
if (record.scheme === 'data' || !record.finished) return; |
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.
update comment
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.
done
@@ -56,7 +56,7 @@ class LoadFastEnough4Pwa extends Audit { | |||
// Ignore requests that don't have timing data or resources that have | |||
// previously been requested and are coming from the cache. | |||
const fromCache = record._fromDiskCache || record._fromMemoryCache; | |||
if (!record._timing || fromCache) { | |||
if (!record._timing || fromCache || !record.finished) { |
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.
update comment (and it seems like it may make more sense to put !record.finished
first)
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.
done
@@ -73,7 +73,7 @@ class OptimizedImages extends Gatherer { | |||
static filterImageRequests(pageUrl, networkRecords) { | |||
const seenUrls = new Set(); | |||
return networkRecords.reduce((prev, record) => { | |||
if (seenUrls.has(record._url)) { | |||
if (seenUrls.has(record._url) || !record.finished) { |
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.
nit: does it make more sense to reverse conditions?
travis is super slow today |
comments updated
I sort of disagree, the fact that this is the most obvious and requires the least thought makes it ok to put it in the afterthought position and devote the most attention/focus to the domain-specific exclusions which come first |
it was a minor point signifying that we still filter out unfinished records almost everywhere so it's mostly an internal change |
Well that's what I mean. Really they could be filtered out before entering into these loops (a la critical request chains) or removed with their own conditional check, but people around here don't seem to like multiple single-line conditionals in a row :) Anyway, it's good as is. |
f315009
to
3c65eaa
Compare
split from #2023 (comment)