fix(marketplace): prevent search tab switches from polluting browser history#36102
Merged
crazywoola merged 1 commit intoMay 13, 2026
Merged
Conversation
Switching tabs inside the search results page (/search/[searchTab]) used router.push, so each tab click added a history entry. As a result, pressing back on All Templates would land on All Plugins instead of returning to the page that opened search. Now handleChange uses router.replace when already on /search/*, and router.push only when navigating into search from elsewhere (e.g. View More on /templates or /plugins). Back from a search results page goes directly to the page the user came from.
crazywoola
approved these changes
May 13, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Important
Fixes #<issue number>.Summary
On the marketplace, pressing the browser back button from All Templates (
/search/templates) landed users on All Plugins (/search/plugins) instead of returning to the page that opened search (e.g./templates).Root cause:
useSearchTab().handleChangeinweb/app/components/plugins/marketplace/atoms.tsalways calledrouter.pushwhen switching the search tab. Because/search/plugins,/search/templates, etc. are distinct paths, every in-page tab switch added a new history entry — so back had to traverse those entries before leaving the search context.Fix: distinguish entry from in-page navigation.
/search/*, switch tabs withrouter.replace— no extra history entry./templates), keeprouter.push— the prior page stays in history so back works.After this change:
/templates→ search input →/search/all→ click Templates tab →/search/templates→ Back goes directly to/templates(previously required two back clicks).Screenshots
/search/templateslands on/search/plugins/search/templatesreturns to/templatesChecklist
make lint && make type-check(backend) andcd web && pnpm exec vp staged(frontend) to appease the lint gods