Skip to content

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

Merged
merged 3 commits into from
Oct 21, 2022
Merged

core(user-flow): add base flags option #14459

merged 3 commits into from
Oct 21, 2022

Conversation

adamraine
Copy link
Member

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.

@adamraine adamraine requested a review from a team as a code owner October 21, 2022 18:28
@adamraine adamraine requested review from connorjclark and removed request for a team October 21, 2022 18:28
*/
_getNextFlags(flags) {
const clonedFlowFlags = this._options?.flags && deepClone(this._options?.flags);
if (!flags) return clonedFlowFlags;
Copy link
Collaborator

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?

Copy link
Member Author

@adamraine adamraine Oct 21, 2022

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.

* @return {LH.UserFlow.StepFlags}
*/
_getNextNavigationFlags(flags) {
const newStepFlags = {...flags};
const newStepFlags = this._getNextFlags(flags) || {};
Copy link
Collaborator

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

Copy link
Member Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants