Skip to content

Conversation

@chriskmnds
Copy link
Contributor

@chriskmnds chriskmnds commented Nov 4, 2025

Closes https://linear.app/a8c/issue/CHE-259/back-button-on-plans-page-returns-me-to-shopping-cart

Proposed Changes

When going through the onboarding flow to checkout and back to the plans step, the "Back" button (on the Plans step) redirects to checkout. This is flagged as an issue to resolve; the back navigation from the "plans" step should be to "domains" (or the auxiliary "use-my-domain"). This is what the PR accomplishes.

This is a tricky one. The PR uses the deprecated goBack method for fixing this. The flow ultimately defines the canonical step order and branching semantics (domains vs. use-my-domain). So it authoritatively decides that the predecessor for Plans is Domains when there’s no in-flow history, avoiding brittle heuristics. That's the essence of the approach, but hopefully there are other fixes (I only later saw that goBack is marked as deprecated).

Deferring to @alshakero or @Automattic/quake team for direction (as I believe they own signup).

Why are these changes being made?

Fixes https://linear.app/a8c/issue/CHE-259/back-button-on-plans-page-returns-me-to-shopping-cart

Testing Instructions

  • Start from /v2/sites and create a new site
  • On the Domains step, pick a domain
  • On the Plans step, pick a plan
  • On Checkout, hit the Back button
  • On the Plans step, hit the Back button
  • You should land back on the Domains step

Pre-merge Checklist

  • Has the general commit checklist been followed? (PCYsg-hS-p2)
  • Have you written new tests for your changes?
  • Have you tested the feature in Simple (P9HQHe-k8-p2), Atomic (P9HQHe-jW-p2), and self-hosted Jetpack sites (PCYsg-g6b-p2)?
  • Have you checked for TypeScript, React or other console errors?
  • Have you tested accessibility for your changes? Ensure the feature remains usable with various user agents (e.g., browsers), interfaces (e.g., keyboard navigation), and assistive technologies (e.g., screen readers) (PCYsg-S3g-p2).
  • Have you used memoizing on expensive computations? More info in Memoizing with create-selector and Using memoizing selectors and Our Approach to Data
  • Have we added the "[Status] String Freeze" label as soon as any new strings were ready for translation (p4TIVU-5Jq-p2)?
    • For UI changes, have we tested the change in various languages (for example, ES, PT, FR, or DE)? The length of text and words vary significantly between languages.
  • For changes affecting Jetpack: Have we added the "[Status] Needs Privacy Updates" label if this pull request changes what data or activity we track or use (p4TIVU-aUh-p2)?

@github-actions
Copy link

github-actions bot commented Nov 4, 2025

@chriskmnds chriskmnds requested review from a team and alshakero November 4, 2025 15:14
@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 Nov 4, 2025
@chriskmnds chriskmnds requested a review from a team November 4, 2025 15:14
Comment on lines +275 to +282
/**
* This is a special case for the Plans step because it can be directly re-entered
* without prior in-flow navigation (e.g. returning from Checkout).
* When on the Plans step, the canonical previous step in this flow is the domains
* step, so we send users there instead of relying on browser history or
* transient post-submit steps.
*/
const plansGoBack = () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We did explore a different approach (not sure if it worked, though), but my vague recollection of the "goBack" method steered things to this solution. Later, I found it's been deprecated.

Again, @alshakero / @Automattic/quake, please provide some direction (or own this completely if you'd like to).

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

Labels

[Status] Needs Review The PR is ready for review. This also triggers e2e canary tests and wp-desktop tests automatically.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants