diff --git a/docs/tickets/mps-24.md b/docs/tickets/mps-24.md index a00640e..d774136 100644 --- a/docs/tickets/mps-24.md +++ b/docs/tickets/mps-24.md @@ -363,7 +363,40 @@ Tests (`test_functional.py::TestProductTagsSpa`): Deferred (occasional click, not the hot path): AJAX-ifying the "Suggest categories" link — still a full navigation by design. -**Phase 2.8e — the LAST link: `form.action` DOM-clobbered** (shipped +**Phase 2.8h — facets compose, not clobber** (shipped 2026-05-16): +operator: "switching one breaks it" — picking a category reset the +active Sort + Price. Cause: the facet category links / "All" link / +top chips / lane "See all" all pointed at a bare +`{tag_base}/tag/{slug}` with **no query string**, so a click dropped +`?sort=` / `?price_*`. (The Sort ``** (shipped 2026-05-16): with 2.8d live, the operator's Network panel showed the proxy-proof `ajax=1` working (a real `fetch` to `tags` → 200, 0.7 kB JSON) — but also four requests to a URL literally named diff --git a/make_post_sell/templates/_facet_nav.j2 b/make_post_sell/templates/_facet_nav.j2 index cb972f3..004eab8 100644 --- a/make_post_sell/templates/_facet_nav.j2 +++ b/make_post_sell/templates/_facet_nav.j2 @@ -29,6 +29,20 @@ {%- if cents is not none -%}{{ (cents / 100)|round(2) }}{%- endif -%} {% endmacro %} +{# Carry the active sort + price across every category link / chip so + switching category does NOT reset sort/price (and vice versa). URL + state, not localStorage: shareable, no-JS, back-button correct, and + the destination SERP already reads ?sort= / ?price_*. Returns the + FULL suffix incl. leading "?" when non-empty, else "" — append it + verbatim to a query-less href. #} +{% macro facet_qs(sort_key, price_min, price_max) -%} +{%- set ns = namespace(parts=[]) -%} +{%- if sort_key -%}{%- set ns.parts = ns.parts + ['sort=' ~ sort_key] -%}{%- endif -%} +{%- if price_min is not none -%}{%- set ns.parts = ns.parts + ['price_min=' ~ (fmt_cents(price_min)|trim)] -%}{%- endif -%} +{%- if price_max is not none -%}{%- set ns.parts = ns.parts + ['price_max=' ~ (fmt_cents(price_max)|trim)] -%}{%- endif -%} +{%- if ns.parts -%}?{{ ns.parts|join('&') }}{%- endif -%} +{%- endmacro %} + {% macro facet_form(base_url, tag_base, sort_options, sort_key, price_min, price_max, facet_tags, active_tag) %}
@@ -68,13 +82,13 @@

Categories