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

Stepper: Fix navigating to a gated step #98083

Merged
merged 6 commits into from
Jan 9, 2025
Merged

Conversation

alshakero
Copy link
Member

@alshakero alshakero commented Jan 8, 2025

Fixes #98059

Proposed Changes

Stepper currently allows flows to navigate to a gated step while logged out, then it detects your auth status and if you're not logged in, it will redirect you to login. This is a roundabout way to redirect to auth when we have all the information we need before going to the gated step.

This change redirects the user to login before redirecting them to a gated step, without navigating to the gated step at all.

Why are these changes being made?

For a saner tracks narrative.

Testing Instructions

This needs a bit of thorough testing.

In-Stepper auth

  1. While incognito,
  2. Open DevTools > Network, tick "Preserve log", and filter by calypso_signup_step_start.
  3. Go to /setup/onboarding.
  4. Skip goals. You should see one more entry of calypso_signup_step_start.
  5. Pick a design. You should NOT see one more entry of calypso_signup_step_start.
  6. Click Continue. You should see one more entry of calypso_signup_step_start.
  7. You should land at the user step. You should see one more entry of calypso_signup_step_start.
  8. Sign up using anything, you should end up at /setup/onboarding/domains.
  9. Click Browser Back, you should end up at the design step.
  10. Pick a design and click Continue.
  11. You should land at the user step
  12. Click Back from the flow's page top left.
  13. You should end up at Pick a theme.

  1. While incognito,
  2. Open DevTools > Network, tick "Preserve log", and filter by calypso_signup_step_start.
  3. Go to /setup/onboarding
  4. Skip goals. You should see one more entry of calypso_signup_step_start.
  5. Pick a design. You should NOT see one more entry of calypso_signup_step_start.
  6. Click Continue. You should see one more entry of calypso_signup_step_start.
  7. You should land at the user step. Click "Log in".
  8. Log in using any method.
  9. You should end up at /setup/onboarding/domains.

Legacy auth

This tests auth that uses legacy non-Stepper auth

  1. While incognito,
  2. Open DevTools > Network, tick "Preserve log", and filter by calypso_signup_step_start.
  3. Go to /setup/newsletter.
  4. You should see one calypso_signup_step_start.
  5. Click "Launch my newsletter".
  6. You should land at the user URL (/start/...) and see one more calypso_signup_step_start.
  7. Sign up.
  8. You should land newsletterSetup page and see one more calypso_signup_step_start.

@matticbot
Copy link
Contributor

matticbot commented Jan 8, 2025

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

App Entrypoints (~183 bytes added 📈 [gzipped])

name           parsed_size           gzip_size
entry-stepper       +791 B  (+0.0%)     +183 B  (+0.0%)

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

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.

@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 fix/navigating-to-gated-step on your sandbox.

@alshakero alshakero marked this pull request as ready for review January 8, 2025 15:37
@alshakero alshakero requested a review from a team as a code owner January 8, 2025 15:37
@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 8, 2025
@alshakero alshakero requested review from MicBosi, chriskmnds, gabriel-fuentes and gabrielcaires and removed request for gabriel-fuentes January 8, 2025 15:38
@alshakero
Copy link
Member Author

@arthur791004 hi! I would really appreciate a review considering you and I are the most familiar with this part.

Copy link
Contributor

@MicBosi MicBosi left a comment

Choose a reason for hiding this comment

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

Tested all requested scenarios - everything works as expected.
I don't see any extraneous calypso_signup_step_start being fired.

I also tested pointing the browser directly to /setup/onboarding/user while logged out: fires calypso_signup_step_start {step: domains, skip_step_render: true}, also as expected. Note in this case the goals and design-setup steps are never invoked, after user step we land in domains and proceed from there.

Copy link
Contributor

@vykes-mac vykes-mac left a comment

Choose a reason for hiding this comment

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

This test well for the described scenarios. It solves a lot of event duplication concerns that are mentioned here. Can we get this merged soon.

@paulopmt1 paulopmt1 merged commit 7966169 into trunk Jan 9, 2025
19 checks passed
@paulopmt1 paulopmt1 deleted the fix/navigating-to-gated-step branch January 9, 2025 16:56
@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 9, 2025
@arthur791004
Copy link
Contributor

Oops...I'm in GK this week and didn't notice the ping 🙈

@alshakero
Copy link
Member Author

No worries!

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.

2. Tracks Event: in goals-first flow domain events should not fire on the account step
6 participants