Skip to content

chore: updates dev with main 04 15#3277

Merged
hellofanny merged 13 commits intodevfrom
chore/updates-dev-with-main-04-15
Apr 15, 2026
Merged

chore: updates dev with main 04 15#3277
hellofanny merged 13 commits intodevfrom
chore/updates-dev-with-main-04-15

Conversation

@hellofanny
Copy link
Copy Markdown
Contributor

@hellofanny hellofanny commented Apr 15, 2026

What's the purpose of this pull request?

Updates dev with latest main (fixes)

Summary by CodeRabbit

Release Notes

  • Bug Fixes

    • Improved city and postal code display logic in region selector, enabling more flexible location information rendering.
  • New Features

    • Added postal code-based support for delivery promise features and regional content caching.
  • Chores

    • Updated internal schema definitions and cache management logic.

lucasfp13 and others added 12 commits March 27, 2026 14:58
## What's the purpose of this pull request?

This PR changes the way base json schemas treat the `after` attribute to
ensure stores migrating from hCMS to the new CMS (Content Platform)
don't have type mismatch.

This should be treated as a **hotfix** given the urgency: we need to
ensure that store migrations (which will begin early next week) occur
without type errors. We should release a new stable version (merge in
`main`) containing this fix and make this version the minimum required
for the migration to take place.

## How it works?

From now on the `after` attribute will be sent to the hCMS and CMS as
`string`, not as `integer`, matching the type is sent to VTEX APIs
(GraphQL queries from `@faststore/api`).

### Starters Deploy Preview


## References

Field validation error on CMS (Content Platform):

<img width="377" height="173" alt="Screenshot 2026-03-25 at 16 53 25"
src="https://github.com/user-attachments/assets/34eef93c-c3ab-4406-a4b3-36a83865f0bc"
/>

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

* **Bug Fixes**
* Pagination cursor for product shelf and product tiles now accepts
string values and uses "0" as the normalized default. This improves
pagination consistency across the storefront, reduces type-related
errors when configuring or navigating paginated product lists, and
ensures more predictable behavior for loading additional product pages.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Mateus Pontes <mateuspo10@gmail.com>
## What's the purpose of this pull request?

<!--- Considering the context, what is the problem we'll solve? Where in
VTEX's big picture our issue fits in? Write a tweet about the context
and the problem itself. --->

## 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

<!--- Spread the knowledge: is there any content you used to create this
PR that is worth sharing? --->

<!--- Extra tip: adding references to related issues or mentioning
people important to this PR may be good for the documentation and
reviewing process --->

## Checklist

<em>You may erase this after checking them all 😉</em>

**PR Title and Commit Messages**

- [ ] PR title and commit messages follow the [Conventional
Commits](https://www.conventionalcommits.org/en/v1.0.0/) specification
- Available prefixes: `feat`, `fix`, `chore`, `docs`, `style`,
`refactor`, `ci` and `test`

**PR Description**

- [ ] Added a label according to the PR goal - `breaking change`, `bug`,
`contributing`, `performance`, `documentation`..

**Dependencies**

- [ ] Committed the `pnpm-lock.yaml` file when there were changes to the
packages

**Documentation**

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

---------

Co-authored-by: Larícia Mota <laricia.mota@vtex.com.br>
Co-authored-by: Matheus P. Silva <cout.matheusps@gmail.com>
Co-authored-by: Leandro Rodrigues <leandro.swf@gmail.com>
Co-authored-by: vtexgithubbot <vtexgithubbot@github.com>
Co-authored-by: Lucas Feijó <lucas.portela@vtex.com>
Co-authored-by: Luiz Falcão <39093175+llfalcao@users.noreply.github.com>
Co-authored-by: Artur Santiago <artur.santiago@cubos.io>
Co-authored-by: Sahan Jayawardana <sahan@clouda.io>
Co-authored-by: Mateus Pontes <mateuspo10@gmail.com>
Co-authored-by: Matheus Martins <mathews_2010@outlook.com>
Co-authored-by: renatomaurovtex <167437775+renatomaurovtex@users.noreply.github.com>
Co-authored-by: Leandro Rodrigues <leandro.rodrigues@vtex.com>
Co-authored-by: Fanny Chien <fanny.chien@vtex.com>
Co-authored-by: Arthur Andrade <arthurfelandrade@gmail.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Thiago Pereira <thiago.pereira@vtex.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
Co-authored-by: Giuliana Rigaud <62848434+giurigaud@users.noreply.github.com>
Co-authored-by: renato <renato.neto@cubos.io>
Co-authored-by: Bruna Santos <brunassdev@gmail.com>
Co-authored-by: BrunaCubos <104789782+BrunaCubos@users.noreply.github.com>
Co-authored-by: Ícaro Oliveira <icarovinici@gmail.com>
Co-authored-by: Bruna Santos <bruna.santos@cubos.io>
Co-authored-by: Everton Ataide <everton.ataide@vtex.com>
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
…RegionButton` (#3259)

## What's the purpose of this pull request?

Show the zip code even if city is empty from validate session API.

## How it works?

After typing the ZIP code `50610290` and clicking "Apply": 
- The modal closed. 
- The session was updated with postalCode: "50610290".
- The button did not update to show the address ❌ — continues
displaying "Set your location"

The postal code was saved correctly, but the city returned as an empty
string "" from the validateSession API. The condition city && postalCode
requires both to be truthy. Since the city is an empty string (""),
which is falsy in JavaScript, the condition fails and displays the
default label even with the postal code filled.

The same problem exists in the RegionButton (desktop).

The frontend should be resilient to this — displaying at least the
postal code when available. I will apply a fix to display only the zip
code when the city field is empty.

| Before | After |
|--------|--------|
| ![beforeApr-06-2026
15-49-03](https://github.com/user-attachments/assets/56d265d5-a40d-49e9-8a77-dc092e31dcb8)
| ![afterApr-06-2026
15-50-13](https://github.com/user-attachments/assets/125b87d2-61f3-493f-bca5-a8d5909daff9)
|


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

* **Bug Fixes**
* Improved location display across region controls: postal codes are
shown reliably even when city is missing; city is omitted when absent;
punctuation and spacing between city and postal code are now handled
correctly to avoid stray commas or missing separators.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Fixing props wrong validation overwriting default value as false when
expected should be a function.

<img width="1551" height="1433" alt="image"
src="https://github.com/user-attachments/assets/25f10d89-4f68-4994-b3ef-05cea2a47cab"
/>


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

## Summary by CodeRabbit

* **Bug Fixes**
* Fixed product gallery page prop handling to ensure consistent behavior
across all scenarios.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What's the purpose of this pull request?

Fix the `storeId` param being sent to the Content Platform client
requests, used to fetch entries and pages. We need to make sure look to
the `contentSource.project` (in discovery config) to check if the
project is using a store different than the old default one
(`faststore`).

It will prevent errors when setting up new stores through WebOps
onboarding (see image below).

<img width="448" height="398" alt="Screenshot 2026-04-09 at 17 16 08"
src="https://github.com/user-attachments/assets/3f53f240-299e-40be-b430-3c54b0aec174"
/>


## How it works?

Ensure the store ID is correctly read from `contentSource.project` when
is set.

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

## Summary by CodeRabbit

* **Refactor**
* Enhanced content source configuration handling to respect custom
project settings when available, with automatic fallback to default
behavior when not configured.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
## What's the purpose of this pull request?

On the PLP, when a user changes their postal code to one where certain
delivery methods (e.g. "Shipping", "Dynamic Estimate") are unavailable,
the delivery facets (Delivery Methods, Delivery Options) are not updated
— the stale filters from the previous postal code remain visible.

## How it works?

- cookieCacheBusting.ts — extend getClientCacheBustingValue() to track
postalCode alongside person.id. The resulting v query param (e.g.
v=timestamp::userId::24230220) is already appended to every GET request
URL, so this single change busts both the CDN cache and the SWR
client-side cache when the postal code changes.

- useProductGalleryQuery.ts / usePageProductsQuery.ts — add doNotRun:
isDeliveryPromiseEnabled && isSessionValidating to gate the gallery and
product queries while validateSession is in flight.

- usePageProductsQuery.ts — include _postalCode in the pagesCache
comparison key (localizedVariablesWithRegion). This is needed so the
hasSameVariables guard — which decides whether SWR is allowed to run at
all — correctly detects a postal code change and sets shouldFetch =
true. Without it, the local cache guard would permanently block the
query for an unchanged set of search params. The SSR pagesCache seed is
updated to match this shape so the first hydration render doesn't
trigger an unnecessary re-fetch.

## How to test it?

Run locally or check this
[preview](https://vendemo-cm9sir9v900u7z6llkl62l70j-mdd18ev50.b.vtex.app)
In discovery.config file:
- use `vendemo` account to test
```
  api: {
    storeId: 'vendemo',
   ..}
```
- enable deliveryPromise:
```
deliveryPromise: {
    enabled: true,
    mandatory: false,
  },
```

You should be the filters being updated after changing the postal code.


https://github.com/user-attachments/assets/bf0814e4-d863-421e-9d15-f0f8de6d87be


### 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

https://vtex.slack.com/archives/C0164SHMAV9/p1776083445684739


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

## Release Notes

* **New Features**
* Product queries now incorporate postal code and region information for
more location-specific results and optimized data caching.
* Enhanced session handling and request optimization for
delivery-related features.
* Cache management now simultaneously monitors authentication state and
location changes for improved accuracy.

* **Tests**
* Extended test coverage for location-aware caching across authenticated
and anonymous user scenarios.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Apr 15, 2026

Caution

Review failed

Pull request was closed or merged during review

Walkthrough

The PR extends cache-busting and regional logic to include postal-code awareness alongside existing person-id handling. Components (RegionBar, RegionButton) now display location info conditionally, while caching and query execution incorporate postal-code state to prevent stale data when region changes.

Changes

Cohort / File(s) Summary
Changelog
packages/components/CHANGELOG.md
Added version 3.98.1 release notes documenting simplification of city/postal code display logic in RegionBar and RegionButton.
Region Components
packages/components/src/molecules/RegionBar/RegionBar.tsx, packages/core/src/components/region/RegionButton/RegionButton.tsx
Refactored conditional rendering of location details to prioritize postal code presence and render city/postal code independently, allowing either to display alone when applicable.
Cache Busting
packages/core/src/utils/cookieCacheBusting.ts, packages/core/test/utils/cookieCacheBusting.test.ts
Extended cache-busting strategy to track postal-code changes alongside person-id; composite values now include timestamp, person ID, and postal code separated by ::. Updated session storage to persist postal code and regenerate cache when either axis changes.
Query & Data Fetching
packages/core/src/sdk/product/usePageProductsQuery.ts, packages/core/src/sdk/product/useProductGalleryQuery.ts, packages/core/src/sdk/graphql/request.ts
Integrated postal-code awareness into query cache keys and control flow; added delivery promise checks to pause fetching during session validation and to region-aware cache operations.
Schema & Configuration
packages/core/cms/faststore/schema.json, packages/core/src/server/content/service.ts, packages/core/src/components/ui/ProductGallery/ProductGalleryPage.tsx
Added reusable schema definitions (base-component, base-page-template); made storeId dynamic based on config; normalized buildExtraProductProps prop to explicitly pass undefined when absent.

Sequence Diagram(s)

sequenceDiagram
    participant Session as Session State
    participant CB as Cache Busting<br/>(cookieCacheBusting)
    participant Storage as Browser Storage<br/>(sessionStorage)
    participant Query as Query Engine<br/>(usePageProductsQuery)
    participant Server as Server/GraphQL

    Session->>CB: personId or postalCode changed
    CB->>CB: Check if both axes absent
    alt Both absent
        CB->>Storage: Clear all busting keys
        CB->>Query: Return null
    else Either axis changed
        CB->>Storage: Read last cached value
        alt Cache still valid
            CB->>Query: Return cached value
        else Cache invalid
            CB->>CB: Build new value<br/>(timestamp::personId::postalCode)
            CB->>Storage: Persist new value
            CB->>Query: Return new value
        end
    end
    
    Query->>Query: Add postalCode to<br/>cache key if enabled
    Query->>Query: Pause (doNotRun=true)<br/>if validating session
    Query->>Server: Fetch with region-aware key
    Server-->>Query: Fresh data
    Query->>Storage: Cache with region key
Loading

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~60 minutes

Possibly related PRs

Suggested labels

bug

Suggested reviewers

  • renatomaurovtex
  • eduardoformiga

Poem

📍 A postal code now guards the cache,
Changing regions? Your data won't clash.
Session and storage dance in sync,
Regions update without a blink. ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately reflects the main objective: syncing dev with main branch updates. It's concise and clear about the branch merge operation.

✏️ 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 chore/updates-dev-with-main-04-15

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

codesandbox-ci Bot commented Apr 15, 2026

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.

@hellofanny hellofanny changed the title Chore: updates dev with main 04 15 chore: updates dev with main 04 15 Apr 15, 2026
@hellofanny hellofanny marked this pull request as ready for review April 15, 2026 16:07
@hellofanny hellofanny requested a review from a team as a code owner April 15, 2026 16:07
@hellofanny hellofanny requested review from emersonlaurentino and gabpaladino and removed request for a team April 15, 2026 16:07
@hellofanny hellofanny merged commit f1ffecf into dev Apr 15, 2026
5 of 7 checks passed
@hellofanny hellofanny deleted the chore/updates-dev-with-main-04-15 branch April 15, 2026 16:14
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.

4 participants