-
Notifications
You must be signed in to change notification settings - Fork 9.5k
core(user-flow): add base flags option #14459
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
Conversation
*/ | ||
_getNextFlags(flags) { | ||
const clonedFlowFlags = this._options?.flags && deepClone(this._options?.flags); | ||
if (!flags) return clonedFlowFlags; |
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: can this line be 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.
No, because then modifying the return value could affect the base flow flags when flags
is undefined
.
core/user-flow.js
Outdated
* @return {LH.UserFlow.StepFlags} | ||
*/ | ||
_getNextNavigationFlags(flags) { | ||
const newStepFlags = {...flags}; | ||
const newStepFlags = this._getNextFlags(flags) || {}; |
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: change name, or put || {}
inside _getNextFlags
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 wanted _getNextFlags
to return undefined
if undefined
is passed in.
_getNextNavigationFlags
will never return undefined
because we ensure that skipAboutBlank
is set.
Sorry for the churn, we did have this option before #14388. However, the step flags object would completely override the flow flags even if there were settings defined on the flow flags that were not defined on the step flags.
This PR should handle the flow flags and step flags properly, by merging them together with step specific flags taking precedence.