Skip to content

Commit 43f33bd

Browse files
hiagolcmcursoragent
andcommitted
docs(changelog): collapse soft-refresh changes into a single entry
Co-authored-by: Cursor <cursoragent@cursor.com>
1 parent dd20008 commit 43f33bd

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99

10+
### Changed
11+
12+
- Replace the full-page reload after zipcode / pickup / shipping-method session writes with a targeted soft refresh that refetches only the segment-dependent storefront queries (resetting search pagination to the first page through render-runtime), updates the fulfillment selection optimistically with rollback on a failed session write, closes the shipping-method modal, and falls back to `location.reload()` when Apollo is unavailable.
13+
1014
## [1.1.4] - 2026-06-11
1115

1216
### Deprecated
@@ -20,11 +24,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2024
- **`UPDATE_ZIPCODE` dispatch:** the postal code is now resolved once at the dispatch entry point (single `getAddress` call) and the resolved address is threaded through the cart-availability check and `submitZipcode`. `getAddress` failures and empty `geoCoordinates` now fail fast as `INVALID_POSTAL_CODE` without invoking the BFF availability call.
2125
- **`submitZipcode`:** runs `getCatalogCount`, `updateOrderForm` and `getPickups` in parallel using `Promise.all`. `getCatalogCount` keeps its UX gate (zero results still surfaces `products-not-found-error`); `updateOrderForm` failures are best-effort (logged and continued); `getPickups` failures degrade gracefully to no active pickups. The two `POST /api/sessions` writes that previously happened during a zipcode submission are coalesced into a single write that already carries the resolved pickup (or `undefined` when there are no active pickups, when `getPickups` rejects, or when `salesChannel` is still loading and pickup fetching is deferred).
2226
- **`validateCartItems`:** skips the `delivery-promises-bff/availability` call entirely when the cart is empty, avoiding an unnecessary network round trip for the common header-flow scenario.
23-
- **Soft refresh after session writes:** `UPDATE_ZIPCODE`, `UPDATE_PICKUP` (`selectPickup`), `SELECT_DELIVERY_SHIPPING_OPTION`, `RESET_FULFILLMENT_METHOD`, and `CLEAR_ZIPCODE` no longer trigger `window.location.reload()`. Instead, after `POST /api/sessions` resolves (and the new `vtex_segment` cookie carrying the updated `deliveryZonesHash` / `pickupPointsHash` is in place), the hook refetches **only** an explicit allowlist of `vtex.store-resources` queries that vary by `@withSegment` (`facetsV2`, `productSearchV3`, `Products`, `Product`, `sponsoredProducts`, `ProductRecommendations`) instead of refetching every observable query — keeping the React tree alive and avoiding traffic for segment-independent queries. `productSearchV3` is reset to the **first page** since a location change invalidates the current pagination: both `from` and `to` are overridden (`from: 0`, `to: to - from`, preserving the page size as `search-result` derives it), and the `page` query string is reset to the first page **through render-runtime** (`setQuery({ page: undefined }, { replace: true })`, only when currently past page 1). Using render-runtime instead of `history.replaceState` is what lets `vtex.search-result` observe the change and reset its "load more" pagination reducer (so the next "load more" goes to page 2, not the page after the stale one — see the paired `vtex.search-result` change). `location.reload()` is kept as a guaranteed fallback when no `ApolloProvider` is mounted, the Apollo internals are inaccessible, or a refetch throws.
24-
- **Single loading cycle on fulfillment selection:** the cart-availability check (`validateCartItems`) no longer toggles the loading flag off when the action is going to proceed — it keeps loading on and lets the continuation (`selectPickup` / `selectDeliveryShippingOption` / `submitZipcode`) own the single loading→idle cycle. Previously the spinner flickered `loading → idle → loading → idle` because the validation and the selection each owned a cycle. Loading is still turned off when the unavailable-items modal is surfaced (so it stays interactive).
25-
- **Fulfillment state sync without reload:** because the soft refresh keeps the React tree alive, `selectPickup`, `SELECT_DELIVERY_SHIPPING_OPTION`, and `RESET_FULFILLMENT_METHOD` now update `deliveryPromiseMethod` / `selectedPickup` optimistically (the values the page reload used to re-derive from the segment on remount), so the shipping-method selector immediately reflects the chosen option.
26-
- **Shipping-method modal auto-close:** the context now exposes `fulfillmentSelectionAppliedId`, which increments whenever a fulfillment method is applied. `shipping-method-selector` watches it and closes the modal — restoring the behavior the page reload previously provided for free, while preserving the unavailable-items abort flow (the modal reopens only when the selection is not applied).
27-
- **Failed session writes roll the optimistic state back:** in `selectPickup`, `SELECT_DELIVERY_SHIPPING_OPTION`, and `RESET_FULFILLMENT_METHOD`, the `POST /api/sessions` call is now wrapped in `try/catch`. On failure, the optimistic `deliveryPromiseMethod` / `selectedPickup` values are restored to their previous state, the loading flag is released (no stuck spinner), the failure is logged, and the soft refresh is skipped — the UI no longer claims a selection that was never written to the session. The pickup preference (`localStorage['vtex.search.pickupInPoint']`) is also persisted only **after** the session write succeeds.
2827

2928
## [1.1.2] - 2026-05-26
3029

0 commit comments

Comments
 (0)