Skip to content

fix: region slider section render - #3318

Merged
lariciamota merged 1 commit into
devfrom
fix/region-slider-section-render
May 14, 2026
Merged

lariciamota merged 1 commit into
devfrom
fix/region-slider-section-render

Conversation

@lariciamota

@lariciamota lariciamota commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

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. feat: Global filter by pickup point (SFS-2458) #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. fix: Remove RegionSlider section props #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. chore: add content platform cms schemas - CP-860 #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

Summary by CodeRabbit

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

Review Change Stack

@lariciamota lariciamota self-assigned this May 13, 2026
@coderabbitai

coderabbitai Bot commented May 13, 2026 •

Copy link
Copy Markdown
Contributor

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: a02c24ad-1879-4b35-8877-e0ccf05bba49

📥 Commits

Reviewing files that changed from the base of the PR and between 8baa617 and cabd504.

📒 Files selected for processing (1)
  • packages/core/src/components/cms/RenderSections.tsx

Walkthrough

RenderSections now guarantees the RegionSlider CMS section is always rendered by introducing a constant, a deduplicating injection helper, and computing augmented sections via useMemo to replace the prior rendering source.

Changes

RegionSlider section guarantee

Layer / File(s) Summary
RegionSlider constant and injection helper
packages/core/src/components/cms/RenderSections.tsx
REGION_SLIDER_SECTION_NAME constant and SECTIONS_OUT_OF_VIEWPORT are defined. withRegionSliderSection appends { name: 'RegionSlider', data: {} } to the combined sections list only when the section is missing from both sections and globalSections, preventing duplicates.
Compute augmented sections with useMemo
packages/core/src/components/cms/RenderSections.tsx
RenderSections computes augmentedSections via useMemo, calling withRegionSliderSection(sections, globalSections) to guarantee presence.
Render augmented sections
packages/core/src/components/cms/RenderSections.tsx
The middle RenderSectionsBase call switches from rendering sections to augmentedSections, with the conditional check updated to augmentedSections.length > 0.

🎯 2 (Simple) | ⏱️ ~10 minutes


🎪 A slider now enters, always on cue,
No section left behind in the CMS view,
Injected with grace, memoized with care,
RegionSlider's promise is always there. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'fix: region slider section render' clearly and concisely describes the main change: fixing a regression where the RegionSlider section failed to render.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/region-slider-section-render

Tip

💬 Introducing Slack Agent: The best way for teams to turn conversations into code.

Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.

  • Generate code and open pull requests
  • Plan features and break down work
  • Investigate incidents and troubleshoot customer tickets together
  • Automate recurring tasks and respond to alerts with triggers
  • Summarize progress and report instantly

Built for teams:

  • Shared memory across your entire org—no repeating context
  • Per-thread sandboxes to safely plan and execute work
  • Governance built-in—scoped access, auditability, and budget controls

One agent for your entire SDLC. Right inside Slack.

👉 Get started


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codesandbox-ci

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.

@lariciamota lariciamota added the bug Something isn't working label May 13, 2026
@lariciamota
lariciamota marked this pull request as ready for review May 13, 2026 18:30
@lariciamota
lariciamota requested a review from a team as a code owner May 13, 2026 18:30
@lariciamota
lariciamota requested review from hellofanny and ommeirelles and removed request for a team May 13, 2026 18:30

@hellofanny hellofanny left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Image

@lariciamota
lariciamota merged commit f9f5e0d into dev May 14, 2026
6 checks passed
@lariciamota
lariciamota deleted the fix/region-slider-section-render branch May 14, 2026 14:17
lariciamota added a commit that referenced this pull request May 14, 2026
Same fix made [here](#3318), but
for the v3.

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

## Summary by CodeRabbit

## Release Notes

* **Improvements**
* Region Slider section is now automatically included in the CMS
rendering system, ensuring it's always available for use even when not
explicitly configured. Duplicate entries are prevented to maintain clean
section management.

<!-- 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/3321)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@eduardoformiga eduardoformiga mentioned this pull request May 15, 2026
1 of 3 tasks
eduardoformiga added a commit that referenced this pull request May 15, 2026
## Summary

Graduation PR from `dev` to `main`. Promotes the `4.1.0-dev.10`
prerelease cycle to the next stable, expected `4.1.1` (only `fix:` and
`chore:` commits since `4.1.0`).

### Notable changes since 4.1.0

- fix: region slider section render (#3318)
- fix: allow_all_components for CMS (#3312)
- chore: test coverage sonarqube (#3319)
- chore: bump next.js to 16.2.6 (#3327)
- chore: phase 4 — split AGENTS.md, add MCP config and spec-kit check
(#3320)
- chore: Update repo read me files (#3314)
- Dark Kitchen Catalog Setup (#3317)

### Back-merge

`main` was back-merged into `dev` (`3d4d24081`) before this PR to bring
in the `4.1.0` release commit and avoid silent overwrites. Conflicts
were resolved in favor of `dev` for code/CMS/version files, with
`CHANGELOG` entries merged from both sides.

## Test plan

- [x] dev CD published `4.1.0-dev.10` on the `dev` dist-tag for all 8
packages
- [ ] After merge, main CD graduates to `4.1.1` on the `latest` dist-tag
- [ ] All 8 packages publish (api, cli, components, core, diagnostics,
lighthouse, sdk, ui)


Made with [Cursor](https://cursor.com)

---------

Co-authored-by: Larícia Mota <[email protected]>
Co-authored-by: Matheus P. Silva <[email protected]>
Co-authored-by: Leandro Rodrigues <[email protected]>
Co-authored-by: vtexgithubbot <[email protected]>
Co-authored-by: Lucas Feijó <[email protected]>
Co-authored-by: Luiz Falcão <[email protected]>
Co-authored-by: Artur Santiago <[email protected]>
Co-authored-by: Sahan Jayawardana <[email protected]>
Co-authored-by: Mateus Pontes <[email protected]>
Co-authored-by: Matheus Martins <[email protected]>
Co-authored-by: renatomaurovtex <[email protected]>
Co-authored-by: Leandro Rodrigues <[email protected]>
Co-authored-by: Fanny Chien <[email protected]>
Co-authored-by: Arthur Andrade <[email protected]>
Co-authored-by: Cursor <[email protected]>
Co-authored-by: Thiago Pereira <[email protected]>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Giuliana Rigaud <[email protected]>
Co-authored-by: renato <[email protected]>
Co-authored-by: Bruna Santos <[email protected]>
Co-authored-by: BrunaCubos <[email protected]>
Co-authored-by: Ícaro Oliveira <[email protected]>
Co-authored-by: Bruna Santos <[email protected]>
Co-authored-by: Everton Ataide <[email protected]>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
Co-authored-by: Otavio Moreira Meirelles <[email protected]>
Co-authored-by: Marco Cardoso <[email protected]>
Co-authored-by: Gabriel Paladino <[email protected]>
Co-authored-by: CodeRabbit <[email protected]>
Co-authored-by: dk-portal[bot] <134092483+dk-portal[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants