chore: updates dev with main 04 15#3277
Conversation
## 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 | |--------|--------| |  |  | <!-- 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 -->
|
Caution Review failedPull request was closed or merged during review WalkthroughThe 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
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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~60 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
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. |
What's the purpose of this pull request?
Updates dev with latest main (fixes)
Summary by CodeRabbit
Release Notes
Bug Fixes
New Features
Chores