Repository navigation
fix: region slider section render - #3318
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
Walkthrough
ChangesRegionSlider section guarantee
🎯 2 (Simple) | ⏱️ ~10 minutes
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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.
Built for teams:
One agent for your entire SDLC. Right inside Slack. 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. Comment |
|
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. |
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 --> [](https://app.coderabbit.ai/change-stack/vtex/faststore/pull/3321) <!-- review_stack_entry_end --> <!-- end of auto-generated comment: release notes by coderabbit.ai -->
## 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>

What's the purpose of this pull request?
The
RegionSlideroverlay 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 onRegionBarcorrectly dispatchesopenRegionSlider(...)anduseUI().regionSlider.isOpentransitions totrue, 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:
RegionSlideras a global CMS section. The runtime inRenderSections.tsxstarted iterating the CMS-suppliedsections[]array and mountingRegionSliderwhenever a section withname: "RegionSlider"was present. Demo stores (vendemo,storeframework,faststoreqa) had the section saved into their hCMS content during this window.RegionSlidersection props #2961 — fix: RemoveRegionSlidersection: stripped the configurable props and then deleted the entire{ name: "RegionSlider" }block fromsections.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.sections.jsonviavtex content split-components. Sincesections.jsonhad already been cleaned ofRegionSlider5 months earlier, the generator produced CP schemas without it. Every CP storefront created or migrated after this point — directly or transitively viastarter.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:
vendemo,storeframework,faststoreqa)How it works?
A small pure helper
withRegionSliderSectionis added insidepackages/core/src/components/cms/RenderSections.tsx. It inspects the CMS-suppliedsectionsandglobalSectionsarrays and:sectionsunchanged 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.{ name: "RegionSlider", data: {} }tosectionsotherwise. 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
augmentedSectionsinRenderSectionsand replaces the originalsectionsreference in the secondRenderSectionsBaseinvocation. The injected entry then flows through the existing pipeline:RenderSectionsBaseresolves the component viacomponents[name], soCUSTOM_COMPONENTS.RegionSliderandPLUGINS_COMPONENTS.RegionSlideroverrides are honored unchanged.LazyLoadingSectionkeeps its existingsectionName === 'RegionSlider' && regionSlider.isOpen && regionSlider.type !== 'none'branch inshouldLoad. The chunk is therefore only downloaded when the shopper actually opens the slider (or after TTI, matching the bundle behavior ofCartSidebarandRegionModal).RegionSlider's internalif (!isOpen) return nullself-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:
discovery.config.js, setdeliveryPromise: { enabled: true }.filterByPickupPoint.enabled = true).RegionBar.RegionSlideroverlay opens with the configured title and pickup-point list.ESC, or backdrop click.regionSlider.isOpenreturns tofalse.Starters Deploy Preview
References
RegionSlidersectionSummary by CodeRabbit