Skip to content

fix: Remove RegionSlider section props - #2961

Merged
lucasfp13 merged 2 commits into
feat/delivery-promise-1.2from
fix/remove-region-slider-section-props
Jul 25, 2025
Merged

lucasfp13 merged 2 commits into
feat/delivery-promise-1.2from
fix/remove-region-slider-section-props

Conversation

@lucasfp13

Copy link
Copy Markdown
Contributor

What's the purpose of this pull request?

This PR intends to remove RegionSlider section props as we won't use it.

@lucasfp13
lucasfp13 requested a review from lariciamota July 24, 2025 21:01
@lucasfp13 lucasfp13 self-assigned this Jul 24, 2025
@lucasfp13
lucasfp13 requested a review from a team as a code owner July 24, 2025 21:01
@lucasfp13
lucasfp13 requested review from renatomaurovtex and removed request for a team July 24, 2025 21:01
@codesandbox-ci

codesandbox-ci Bot commented Jul 24, 2025 •

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

@lucasfp13
lucasfp13 merged commit a18fc9f into feat/delivery-promise-1.2 Jul 25, 2025
@lucasfp13
lucasfp13 deleted the fix/remove-region-slider-section-props branch July 25, 2025 17:45
lariciamota added a commit that referenced this pull request Jul 28, 2025
## What's the purpose of this pull request?

Feature branch for the Delivery Promise feature - phase 1.2 (filters by
shipping method).

- #2803 
- #2826
- #2845
- #2847 
- #2851
- #2852 
- #2847
- #2872
- #2886
- #2909
- #2916 
- #2918 
- #2922 
- #2887 
- #2944 
- #2953 
- #2956 
- #2955 
- #2961 
- #2962 

## How it works?

<!--- Tell us the role of the new feature, or component, in its context.
Provide details about what you have implemented and screenshots if
applicable. --->

## How to test it?

<!--- Describe the steps with bullet points. Is there any external link
that can be used to better test it or an example? --->

### Starters Deploy Preview

<!--- Add a link to a deploy preview from `starter.store` with this
branch being used. --->

<!--- Tip: You can get an installable version of this branch from the
CodeSandbox generated when this PR is created. --->

## References

- [Jira epic](https://vtex-dev.atlassian.net/browse/SFS-2038)

## Checklist

**Documentation**

- [ ] For documentation changes, ping `@Mariana-Caetano` to review and
update (Or submit a doc request)

---------

Co-authored-by: Lucas Feijó <[email protected]>
Co-authored-by: Fanny Chien <[email protected]>
Co-authored-by: Fanny Chien <[email protected]>
Co-authored-by: Otavio Moreira Meirelles <[email protected]>
lariciamota added a commit that referenced this pull request May 14, 2026
## What's the purpose of this pull request?

The `RegionSlider` overlay no longer opens on stores that use **Content
Platform** as their content source, even when *"Should enable global
filter by pickup point"* is enabled in the CMS. The trigger button on
`RegionBar` correctly dispatches `openRegionSlider(...)` and
`useUI().regionSlider.isOpen` transitions to `true`, but no overlay
appears in the DOM and no warning is logged.

The defect is the cumulative consequence of three correct-in-isolation
changes that compose poorly:

1. **#2887 — Global filter by pickup point**: introduced `RegionSlider`
as a global CMS section. The runtime in `RenderSections.tsx` started
iterating the CMS-supplied `sections[]` array and mounting
`RegionSlider` whenever a section with `name: "RegionSlider"` was
present. Demo stores (`vendemo`, `storeframework`, `faststoreqa`) had
the section saved into their hCMS content during this window.
2. **#2961 — fix: Remove `RegionSlider` section**: stripped the
configurable props and then deleted the entire `{ name: "RegionSlider"
}` block from `sections.json`, because the section had no editable
per-page configuration. Stores that already had the section persisted in
hCMS kept working (hCMS doesn't revalidate persisted content against the
current schema), but the schema no longer offers it for new authoring.
3. **#3071 — chore: add content platform cms schemas**: generated the CP
schemas from `sections.json` via `vtex content split-components`. Since
`sections.json` had already been cleaned of `RegionSlider` 5 months
earlier, the generator produced CP schemas without it. Every CP
storefront created or migrated after this point — directly or
transitively via `starter.store` — inherits this gap. The CP service
strictly validates content entries against the uploaded schema, so no CP
store can save the section.

**Impact matrix:**


| Content source | Before this fix | After this fix |
|
-----------------------------------------------------------------------------------------
| ---------------------------------------- | ---------------------- |
| Content Platform, any state | Broken (trigger click is a silent no-op)
| Works |
| hCMS, section persisted in pre-#2961 content (`vendemo`,
`storeframework`, `faststoreqa`) | Works | Works (no duplication) |
| hCMS, fresh store or content created after #2961 | Broken | Works |


## How it works?

A small pure helper `withRegionSliderSection` is added inside
`packages/core/src/components/cms/RenderSections.tsx`. It inspects the
CMS-supplied `sections` and `globalSections` arrays and:

- Returns `sections` unchanged when **either** array already contains a
`{ name: "RegionSlider" }` entry. This is the legacy hCMS path — the
existing iteration mounts the component as it always has.
- Appends `{ name: "RegionSlider", data: {} }` to `sections` otherwise.
This is the CP path and the fresh-hCMS path — the runtime guarantees the
section without depending on the CMS schema.

The result is memoized as `augmentedSections` in `RenderSections` and
replaces the original `sections` reference in the second
`RenderSectionsBase` invocation. The injected entry then flows through
the existing pipeline:

- `RenderSectionsBase` resolves the component via `components[name]`, so
`CUSTOM_COMPONENTS.RegionSlider` and `PLUGINS_COMPONENTS.RegionSlider`
overrides are honored unchanged.
- `LazyLoadingSection` keeps its existing `sectionName ===
'RegionSlider' && regionSlider.isOpen && regionSlider.type !== 'none'`
branch in `shouldLoad`. The chunk is therefore only downloaded when the
shopper actually opens the slider (or after TTI, matching the bundle
behavior of `CartSidebar` and `RegionModal`).
- `RegionSlider`'s internal `if (!isOpen) return null` self-gate remains
the sole source of truth for visibility — no DOM is rendered when the
overlay is closed.


## How to test it?

Set up a Content Platform-based storefront (you can use the one from the
thread in the refs) and verify:

- Enable Delivery Promise:
  - In `discovery.config.js`, set `deliveryPromise: { enabled: true }`.
- In the CMS global settings, enable *"Should enable global filter by
pickup point"* (sets `filterByPickupPoint.enabled = true`).
- Open any page (home, PLP, PDP, search) and set a postal code.
- Click the **Filter by Store** button on the `RegionBar`.
- Expected: the `RegionSlider` overlay opens with the configured title
and pickup-point list.
- Close the overlay via the close button, `ESC`, or backdrop click.
- Expected: the overlay closes, `regionSlider.isOpen` returns to
`false`.

### Starters Deploy Preview



## References

- [Jira task](https://vtex-dev.atlassian.net/browse/SO-623)
- [Slack
thread](https://vtex.slack.com/archives/C051B6LL91U/p1778608689625729)
- Original feature PR: [#2887 — Global filter by pickup
point](#2887)
- Schema cleanup PR: [#2961 — fix: Remove `RegionSlider`
section](#2961)
- CP schemas introduction PR: [#3071 — chore: add content platform cms
schemas](#3071)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

* **Bug Fixes**
* The region slider CMS section is now guaranteed to be consistently
available across all CMS layouts.

<!-- review_stack_entry_start -->

[![Review Change
Stack](https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg)](https://app.coderabbit.ai/change-stack/vtex/faststore/pull/3318)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants