Skip to content
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

Goals first: Reset onboard store when entering the flow #97936

Merged
merged 9 commits into from
Jan 7, 2025

Conversation

zaguiini
Copy link
Contributor

@zaguiini zaguiini commented Jan 3, 2025

Closes #97887.

Proposed Changes

Title. We're keeping the domain selection information as it is in case the user wants to create a new site with their previously selected domain (that they haven't bought.)

Why are these changes being made?

Because right now it's impossible to create two sites through /setup/onboarding.

Testing Instructions

Enter /setup/onboarding and create a site. Enter the flow again and create a second site. You should end up with two sites.

On trunk, the user is getting redirected to /sites after trying to create the second site.

Also, go through the flow with a paid domain and leave the cart while keeping the domain there. Enter /setup/onboarding and verify that the paid domain is preselected.

@zaguiini zaguiini marked this pull request as ready for review January 3, 2025 13:45
@zaguiini zaguiini requested a review from a team January 3, 2025 13:45
@matticbot matticbot added the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 3, 2025
@zaguiini zaguiini self-assigned this Jan 3, 2025
@matticbot
Copy link
Contributor

matticbot commented Jan 3, 2025

Here is how your PR affects size of JS and CSS bundles shipped to the user's browser:

App Entrypoints (~83 bytes removed 📉 [gzipped])

name                   parsed_size           gzip_size
entry-subscriptions         -126 B  (-0.0%)      -97 B  (-0.0%)
entry-main                  -126 B  (-0.0%)      -97 B  (-0.0%)
entry-login                 -126 B  (-0.0%)      -97 B  (-0.0%)
entry-domains-landing       -126 B  (-0.0%)      -97 B  (-0.0%)
entry-browsehappy           -126 B  (-0.1%)      -97 B  (-0.2%)
entry-stepper                -42 B  (-0.0%)      -83 B  (-0.0%)

Common code that is always downloaded and parsed every time the app is loaded, no matter which route is used.

Sections (~545 bytes added 📈 [gzipped])

name                     parsed_size           gzip_size
onboarding-flow              +1018 B  (+4.8%)     +460 B  (+6.4%)
site-settings                  +84 B  (+0.0%)      +16 B  (+0.0%)
signup                         +84 B  (+0.0%)      +12 B  (+0.0%)
settings                       +84 B  (+0.0%)      +16 B  (+0.0%)
jetpack-connect                +84 B  (+0.0%)      +13 B  (+0.0%)
home                           +84 B  (+0.0%)      +18 B  (+0.0%)
checkout                       +84 B  (+0.0%)      +18 B  (+0.0%)
accept-invite                  +84 B  (+0.0%)      +13 B  (+0.0%)
link-in-bio-tld-flow           +12 B  (+0.0%)       +6 B  (+0.0%)
import-hosted-site-flow        +12 B  (+0.0%)       +1 B  (+0.0%)
copy-site-flow                 +12 B  (+0.0%)       +6 B  (+0.0%)

Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to.

Async-loaded Components (~101 bytes added 📈 [gzipped])

name                                                                              parsed_size           gzip_size
async-load-signup-steps-domains                                                        +259 B  (+0.0%)      +43 B  (+0.0%)
async-load-purchase-modal-wrapper                                                       +84 B  (+0.0%)      +11 B  (+0.0%)
async-load-my-sites-checkout-purchase-modal-is-eligible-for-one-click-checkou...        +84 B  (+0.0%)      +11 B  (+0.0%)
async-load-calypso-lib-analytics-signup                                                 +84 B  (+0.6%)      +12 B  (+0.3%)
async-load-calypso-layout-masterbar-checkout                                            +84 B  (+0.1%)      +14 B  (+0.1%)
async-load-calypso-blocks-editor-checkout-modal                                         +84 B  (+0.0%)      +10 B  (+0.0%)

React components that are loaded lazily, when a certain part of UI is displayed for the first time.

Legend

What is parsed and gzip size?

Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory.
Gzip Size: Compressed size of the JS and CSS files. This much data needs to be downloaded over network.

Generated by performance advisor bot at iscalypsofastyet.com.

@zaguiini
Copy link
Contributor Author

zaguiini commented Jan 3, 2025

@paulopmt1 reported a problem with the approach (p1735915114483079-slack-C04H4NY6STW), so I piggybacked on @candy02058912's idea of clearing up the step persisted state.

This should be good to go now!

@escapemanuele escapemanuele requested a review from a team January 3, 2025 15:52
Copy link
Contributor

@paulopmt1 paulopmt1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Work as intended. Shared a full review here: p1736002952764819/1735915114.483079-slack-C04H4NY6STW

My main concern as a follow-up is to ensure the .wordpress.com domain suggestion always shows up as the first time we go through the flow.

Thanks for working on it @zaguiini and @candy02058912 !

Copy link
Member

@p-jackson p-jackson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After testing and talking in p1736137453158579/1735915114.483079-slack-C04H4NY6STW I think it's ok to move the reseting of the onboarding state to the front of the flow.

Copy link
Contributor

@candy02058912 candy02058912 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, go through the flow with a paid domain and leave the cart while keeping the domain there. Enter /setup/onboarding and verify that the paid domain is preselected.

Domain is preseleted.
But the price isn't 0 with the "Free for the first year with annual paid plans." description. Also, the price doesn't match the regular price.

demo.mp4

Don't think that's a blocker for merging this PR as the amount in the checkout cart is still correct. (Free domain with an annual plan selected)

packages/onboarding/src/hooks/use-persisted-state.ts Outdated Show resolved Hide resolved
@zaguiini zaguiini force-pushed the goals-first/reset-store-at-start-of-flow branch from c5ee77d to 1742c4c Compare January 6, 2025 19:15
@zaguiini
Copy link
Contributor Author

zaguiini commented Jan 6, 2025

That's fair @candy02058912 , here it is: 1742c4c


And also thank you for reporting that domain price problem. It was fixed with the same EDIT: It's not fixed, I can still reproduce that.

The weird thing is if I go back to the design setup step and skip to domains again, it works 🤷🏻


Here's a fix that makes the free wpcom domain show up: 82c9bd8

cc @alshakero let me know if there's a better solution for this problem.


@p-jackson @vykes-mac, feel free to add the site setup onboard reset as a commit to this PR 👍🏻

@autumnfjeld
Copy link
Contributor

For reference, team testing discussed here: p1736205027317489/1736196927.663189-slack-C085HCWCEDN

wasSignupCheckoutPageUnloaded() &&
signupDestinationCookieExists &&
isReEnteringFlow &&
getSignupCompleteSlug()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've added this check because further on (in the createSite function), if isManageSiteFlow is true then we go ahead an use the signup complete slug, just assuming that it will be valid. So we shouldn't really go into that branch unless we also know the signup complete slug is valid.

This was causing an issue where if the user went back and made another site using the onboarding flow a 2nd time, isReEnteringFlow so it didn't think it had to create a site. But we don't have a site slug, we really do need to create a site.

@matticbot
Copy link
Contributor

This PR modifies the release build for the following Calypso Apps:

For info about this notification, see here: PCYsg-OT6-p2

  • notifications
  • wpcom-block-editor

To test WordPress.com changes, run install-plugin.sh $pluginSlug goals-first/reset-store-at-start-of-flow on your sandbox.

@candy02058912
Copy link
Contributor

candy02058912 commented Jan 7, 2025

Shared testing creating two sites here: p1736224151854289/1736196927.663189-slack-C085HCWCEDN
There's also more discussions regarding this PR in that thread, so linking it here for context in the future.

Let's 🚢

@p-jackson p-jackson merged commit 9aae00e into trunk Jan 7, 2025
11 checks passed
@p-jackson p-jackson deleted the goals-first/reset-store-at-start-of-flow branch January 7, 2025 06:01
@github-actions github-actions bot removed the [Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically. label Jan 7, 2025
p-jackson added a commit that referenced this pull request Jan 7, 2025
p-jackson added a commit that referenced this pull request Jan 7, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug: Trying to create two sites in sequence in the new onboarding flow doesn't work
7 participants