-
Notifications
You must be signed in to change notification settings - Fork 2k
Fix back button on domains step when coming from playground #108656
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
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
|
This PR modifies the release build for the following Calypso Apps: For info about this notification, see here: PCYsg-OT6-p2
To test WordPress.com changes, run |
| case 'playground': | ||
| return navigate( 'domains' ); | ||
| case 'playground': { | ||
| const backTo = window.location.pathname + window.location.search; |
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 checked the code, and unfortunately, the domains step has a custom back button that doesn't rely on automatic history. So this is the best approach.
The only change I suggest is to use React useLocation() hook, which is mockable in tests. Feel free to use it or land this PR as is.
Great work, as always 🙂
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 tried and it breaks. Pls see my revert commit's message. Going to merge as is.
2fe2a4d to
bb4e51d
Compare
When navigating from the playground step to the domains step in the onboarding flow, the back button incorrectly showed "Back to sites" instead of allowing the user to return to the playground. The original playground commit (999290b) fixed this in the legacy domains step, but the fix was lost during the Domain Search Rewrite (f219972). The rewritten step uses a `back_to` query parameter to control the back button, but the playground-to-domains navigation never set it. Pass the current playground URL as `back_to` when navigating to the domains step so the existing back button logic picks it up correctly.
…testing" This reverts commit df46a61. useLocation() from react-router returns paths relative to the router basename ("setup"), so it gives /onboarding/playground instead of /setup/onboarding/playground. Since back_to is used as an href on <Step.BackButton>, it needs the full browser path. Hence, reverted to window.location which provides the correct absolute path.
bb4e51d to
ef551a0
Compare
When navigating from the playground step to the domains step in the onboarding flow, the back button incorrectly showed "Back to sites" instead of allowing the user to return to the playground.
The original playground commit (999290b) fixed this in the legacy domains step, but the fix was lost during the Domain Search Rewrite (f219972). The rewritten step uses a
back_toquery parameter to control the back button, but the playground-to-domains navigation never set it.Pass the current playground URL as
back_towhen navigating to the domains step so the existing back button logic picks it up correctly.Fixes https://linear.app/a8c/issue/ARC-1458/back-button-from-domains-step-links-to-mywordpresscomsites
Proposed Changes
Why are these changes being made?
Testing Instructions
Pre-merge Checklist