RSM-2998: Persist Jetpack Search dashboard active tab via URL state#48752
RSM-2998: Persist Jetpack Search dashboard active tab via URL state#48752Copilot wants to merge 8 commits into
Conversation
|
@copilot follow the PR template |
Updated the PR description to match Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 1 file.
|
|
@claude review please |
|
Claude finished @adamwoodnz's task in 1m 39s —— View job PR Review
The implementation is clean and directly addresses the issue. Here are my findings: Implementation (
|
@copilot add this comment |
Added the maintainability note above |
73fe91e to
17c6fea
Compare
Fixes RSM-2998
Why
Users of the Jetpack Search admin dashboard lose their place every time they refresh: the dashboard always lands back on Plan & Usage even if they were working in AI Answers (and soon, Settings). This is especially jarring after saving an experience change, since the refresh snaps them away from the control they just used. This PR keeps users on whichever tab they had selected across refresh, share, and back/forward.
Proposed changes
?tab=<value>viahistory.replaceStatewhenever the user switches tabs (no history-entry spam).URLSearchParamson mount, with an allowlist (plan-usage,ai-answers) so unknown or missing values fall back to the default tab.typeof window === 'undefined'so SSR / non-browser callers still get the default tab.?tab=, ignoring an unknown?tab=(URL left untouched), and the URL update on user-driven tab change.Related product discussion/links
copilot/add-inline-customization-links-overlay).Does this pull request change what data or activity we track or use?
No. The tab value lives only in the URL on the user's own browser; nothing new is sent to the server or logged.
Testing instructions
wp-admin > Jetpack > Search. Confirm the dashboard opens on Plan & Usage and the URL has no?tab=parameter (or has?tab=plan-usageafter you click it).?tab=ai-answerswithout adding a new browser-history entry (back button should still go to the page you came from).?tab=bogus-valueand reload. The dashboard should fall back to Plan & Usage, and the URL should be left as-is (no rewrite).