fix: tag chip "All" navigates fully from a filtered URL
When the page loads at ?tag=<slug>, the server has rendered a SUBSET of products (the tag-filtered grid). The DOM only contains that subset, so clicking "All" via the in-place filter just unhides what's already visible — it can't synthesize the rest of the shop, and on the lanes home_layout it can't rebuild the lane sections at all. tag_filter.js now bails on init when the URL carries a ?tag= param. Chips on filtered pages do normal navigation, so clicking "All" hits the server and gets back the correct unfiltered home (flat grid for home_layout 0/1, sectioned lanes for home_layout 2). The fast in-place path still works on the unfiltered home, which is when it's correct anyway (full set of products is in the DOM).
This commit is contained in:
parent
7c227ab467
commit
adf145a7e8
1 changed files with 12 additions and 0 deletions
|
|
@ -33,6 +33,18 @@
|
|||
return;
|
||||
}
|
||||
|
||||
// When the page was loaded with ?tag=<slug>, the server rendered a
|
||||
// SUBSET of products (filtered to that tag). The DOM here doesn't
|
||||
// contain the rest of the shop, so clicking "All" — or another tag —
|
||||
// via in-place filter would only ever toggle what's already visible.
|
||||
// Worse, on the lanes layout (home_layout=2), the unfiltered home is
|
||||
// a different markup entirely (lanes, not flat grid) — only a full
|
||||
// navigation can rebuild it. Bail and let chips navigate normally.
|
||||
const initialParams = new URLSearchParams(window.location.search);
|
||||
if (initialParams.get("tag")) {
|
||||
return;
|
||||
}
|
||||
|
||||
const items = grid.querySelectorAll(".serp-item");
|
||||
|
||||
function applyFilter(slug) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue