-
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
report: convert v6 emulatedFormFactor to v7 formFactor #11876
Conversation
@@ -424,10 +424,24 @@ class Util { | |||
networkThrottling = Util.i18n.strings.runtimeUnknown; | |||
} | |||
|
|||
// TODO(paulirish): revise Runtime Settings strings: https://github.com/GoogleChrome/lighthouse/pull/11796 | |||
const deviceEmulation = settings.formFactor === 'mobile' |
This comment was marked as resolved.
This comment was marked as resolved.
Sorry, something went wrong.
: Util.i18n.strings.runtimeDesktopEmulation; | ||
|
||
let deviceEmulation; | ||
// COMPAT: remove this fallback handling at Lighthouse v8 |
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.
Why remove in v8? Don't we want to keep the renderer backwards-compat indefinitely?
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.
Oh, right, there's three possibilities for the old way...
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.
deviceEmulation = {
mobile: Util.i18n.strings.runtimeMobileEmulation,
desktop: Util.i18n.strings.runtimeDesktopEmulation,
none: Util.i18n.strings.runtimeNoEmulation,
}[settings.formFactor || settings.emulatedFormFactor || 'none']
maybe?
or
deviceEmulation = {
mobile: Util.i18n.strings.runtimeMobileEmulation,
desktop: Util.i18n.strings.runtimeDesktopEmulation,
}[settings.formFactor || settings.emulatedFormFactor] || Util.i18n.strings.runtimeNoEmulation
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.
yes
can we upgrade the LHR to the expected format in |
This reverts commit 6cb6812.
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.
can we upgrade the LHR to the expected format in
prepareReportResult
like we do forconfigSettings.locale
and friends so the rest of the code can assume the genuine form (and keep all the@ts-expect-error
s in one place)?
love it
@@ -66,6 +66,10 @@ class Util { | |||
if (!clone.configSettings.locale) { | |||
clone.configSettings.locale = 'en'; | |||
} | |||
if (!clone.configSettings.formFactor) { | |||
// @ts-expect-error fallback handling for emulatedFormFactor |
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.
can you add a version comment like on the other comments? Someday we won't remember when this change happened :)
const deviceEmulation = settings.formFactor === 'mobile' | ||
? Util.i18n.strings.runtimeMobileEmulation | ||
: Util.i18n.strings.runtimeDesktopEmulation; | ||
const deviceEmulation = { |
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.
The fallback case shouldn't ever happen for the 'mobile'|'desktop'
type it is today, so probably worth adding a comment about why there's a fallback to runtimeNoEmulation
Well, you were too fast, but maybe in the arbitrary strings PR :) edit from paul since github isn't automatically crosslinking...... yup i addressed in #11796 (comment) |
fixes #11873
restored the handling for the report's "Device" string for v6.
I redid the conditionals using ternaries, but that bit has the same logic.