Repository navigation
fix(core): drop stale pickupPoint facet on delivery method switch - #3606
Open
caiotheodoro wants to merge 1 commit into
Open
caiotheodoro wants to merge 1 commit into
caiotheodoro wants to merge 1 commit into
Conversation
onDeliveryFacetChange computed the pickupPoint cleanup for the filterDispatch path but discarded the result of Array.prototype.concat, which is non-mutating. In the filter slider (FilterSlider) the stale pickupPoint facet stayed in selected: the pickup-in-point radio kept rendering as selected next to the new method, and toggling back to pickup-in-point dropped the chosen pickup point from the URL entirely. Push the selected pickupPoint facets into facetsToToggle when dispatching so the reducer toggles them off, matching the non-dispatch path.
caiotheodoro
requested review from
eduardoformiga and
lemagnetic
and removed request for
a team
November 24, 2026 00:02
There was a problem hiding this comment.
Orca Security Scan Summary
| Status | Check | Issues by priority | |
|---|---|---|---|
| Infrastructure as Code | View in Orca | ||
| OSS Licenses | View in Orca | ||
| Malicious Packages | View in Orca | ||
| SAST | View in Orca | ||
| Secrets | View in Orca | ||
| Vulnerabilities | View in Orca |
|
DK Review — Audit SummaryVerdict: ✅ CLEAN
Scenarios evaluated: feature-flags, general-review 📋 Findings (0)No findings. DK Review v1.0.0 | To contest a finding, reply in its thread |
This branch has not been deployed
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.

0 New Issues
0 Fixed Issues
0 Accepted Issues
What's the purpose of this pull request?
onDeliveryFacetChangeinuseDeliveryPromisedrops the selectedpickupPointfacet whenever the shopper switches to a delivery method otherthan
pickup-in-point. That works on the desktop filter (FilterDesktop,which goes through
setSearchStateon a filtered facet list) but not in themobile filter drawer (
FilterSlider, which dispatchestoggleFacetsagainstthe full
selectedlist): the cleanup line was a.concat()call whose resultis discarded, so the stale facet never leaves
selected.How it works?
The else branch now collects the currently selected
pickupPointfacets and,when
filterDispatchis set, pushes them intofacetsToToggleso the reducertoggles them off — mirroring how the
pickup-in-pointbranch pushes thepickupPointfacet to toggle it on. The non-dispatch path is unchanged: thefiltered
currentSelectedFacetslist already excludespickupPointfacets.Before this fix, switching to "delivery" left
{pickupPoint: <id>}selected,which kept the
pickup-in-pointradio looking selected next to "delivery" and,if the shopper toggled back to
pickup-in-point, removed the pickup point fromthe URL entirely (
shipping=pickup-in-pointwith nopickupPoint).How to test it?
test/sdk/deliveryPromise/useDeliveryPromise.browser.test.tsxreplay thedispatched action through the real
toggleFacetsreducer logic:pickupPointfromselected;pickup-in-pointrestorespickup-in-point+pickupPointinstead of losing the point.pnpm vitest run test/sdk/deliveryPromise— 28/28 pass.deliveryPromise.enabled, pick a pickup point, openthe filter slider, select another delivery method —
pickup-in-pointshouldno longer stay selected, and toggling back keeps the pickup point.
References
Fixes #3605.
packages/core/src/sdk/deliveryPromise/useDeliveryPromise.ts,packages/core/src/components/search/Filter/FilterSlider.tsx.