Skip to content

feat: release version 2026 06 01 - #3370

Merged
hellofanny merged 239 commits into
mainfrom
release/version-2026-06-01
Jun 1, 2026
Merged

hellofanny merged 239 commits into
mainfrom
release/version-2026-06-01

Conversation

@hellofanny

@hellofanny hellofanny commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

release version 2026-06-01

Summary by CodeRabbit

  • New Features

    • Added image preloading for product listing pages to improve perceived performance.
    • Enhanced product image loading with priority control.
  • Bug Fixes

    • Fixed flex alignment styling in toast and component layouts.
    • Improved session refresh behavior in local development environments.
    • Fixed SlideOver viewport height responsiveness using dynamic viewport units.
  • Tests

    • Added comprehensive test coverage for session initialization and localization handling.
  • Chores

    • Updated module imports and internal refactoring across packages.
    • Dependency version updates for improved compatibility.

lariciamota and others added 30 commits October 30, 2025 09:26
## What's the purpose of this pull request?

Build our default image loader.

## How it works?

- When the FastStore image component is used, the `faststoreLoader` is
used.
- When the Next image component is used directly, the
`customImageLoader` is used.
- Both have the same behavior when handling images from VTEX (from the
file manager/cms and product images) -- they add to the URL the info
regarding size, quality and aspect, since those VTEX services already
handles optimizations.
- The difference between those loaders is regarding external images --
the one used for Next images uses the Next optimizations, and the
FastStore one doesn't.

It won't be necessary to use a feature flag like
`enableVtexAssetsLoader`.

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

PR: vtex-sites/faststoreqa.store#881

## References

- [Jira task](https://vtex-dev.atlassian.net/browse/SFS-2878)
- [Slack
thread](https://vtex.slack.com/archives/C03L3CRCDC4/p1761334946034969)
## What's the purpose of this pull request?

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

This PR fixes a visual bug in the TextareaField component where long
text would appear underneath the floating label during scroll, making it
difficult to read. The issue was identified during the review of [PR
#2705](#2705 (review)).

Additionally, comprehensive Storybook documentation was added to
showcase all TextareaField variations and use cases.


https://github.com/user-attachments/assets/a86cd4df-e286-40f4-82b0-271a8bc66a26




## How it works?

**Bug Fix:**
- Added `--fs-textarea-field-label-background-color` CSS variable to
`packages/ui/src/components/molecules/TextareaField/styles.scss`
- Set default value to neutral-0 (white) to prevent text from showing
through the label
- When the textarea content is long and the user scrolls, the label now
has an opaque background, preventing text overlap

## How to test it?

**Test the scroll bug fix:**

From the project root:
```bash
pnpm --filter "@faststore/storybook" dev
```

Or navigate to the storybook package:
```bash
cd packages/storybook
pnpm dev
```

Then:
1. Open http://localhost:6006 in your browser
2. Navigate to **"TextareaField"** → **"LargeText"** story
3. Scroll inside the textarea content
4. Verify that the text no longer appears underneath the label

## References
- **Related Issue:** [PR #2705 - TextareaField label overlap issue
identified](#2705 (review))
- **Task:** [SFS-2385 ](https://vtex-dev.atlassian.net/browse/SFS-2385)
## What's the purpose of this pull request?

Revert changes from 
- #2988
since the approach to filter shopper changes to use text field instead
of selected filter in the drawer.

## details

remove purchaseAgentId filter and related components from
`MyAccountListOrders`.

This update removes the purchaseAgentId filter and its associated
components from the MyAccountListOrders section. The changes include:
- Deleting the MyAccountFilterFacetPlacedBy component and its styles.
- Adjusting the MyAccountListOrders and MyAccountSelectedTags components
to eliminate references to purchaseAgentId.
- Cleaning up related styles and imports to streamline the codebase.

These modifications aim to simplify the order filtering process and
improve overall maintainability.
## What's the purpose of this pull request?

From a current Next.js's known issue
([discussion#44013](vercel/next.js#44013)),
these changes aim to add an experimental custom hook to handle scroll
restoration when navigating back from PDPs to PLPs.


https://github.com/user-attachments/assets/9a452081-4c65-4a83-8c16-9775f97d226d

Along with this experimental hook, some adjustments needed to be made to
correct the behavior of related components, such as `Sentinel`.

While the Next.js experimental `scrollRestoration` flag is not working
as it should, we are proposing this FastStore's experimental scroll
restoration alternative.

## How it works?

While navigating through PLPs and loading more pages, when users
navigate to a PDP and navigate back the scroll should be restored to the
last position before the navigation.

### Starters Deploy Preview

vtex-sites/faststoreqa.store#878

## References

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

Merge the changes from main
## What's the purpose of this pull request?

By using the direction property users will be able to use RTL or LTR
layouts.
## What's the purpose of this pull request?

With these changes, if merchants remove the footer logo the entire
footer component will not be hid anymore, it will throw a console error
but the component should be displayed with no logo.
#3077)

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

This PR fixes the `border-radius` of the Slider thumb in Firefox. The
current CSS rule for Mozilla uses an inexistent variable, making the
browser render a square instead of a circle:

<img width="1028" height="181" alt="image"
src="https://github.com/user-attachments/assets/50c08d79-a6a9-4d31-b2e7-5ef9e287080f"
/>

## How it works?

The `--fs-slider-thumb-radius` variable is replaced by
`--fs-slider-thumb-border-radius`, the one that is defined in the
default thumb variables.

## How to test it?

- Use the `Local Install Instructions` from the [CodeSandbox
CI](https://ci.codesandbox.io/status/vtex/faststore/pr/3077) to add this
version in the `package.json` of a store.
- Import the `Slider` atom (and styles) in a component following the
docs: https://developers.vtex.com/docs/guides/faststore/atoms-slider
- Run the store in development mode and browse it in Mozilla Firefox.

### Starters Deploy Preview

I'm unable to generate a preview link but here's a screenshot from
localhost:

<img width="1287" height="617" alt="image"
src="https://github.com/user-attachments/assets/f0a5a5e9-d657-41db-9415-303b5d17fefd"
/>

## Checklist

**PR Title and Commit Messages**

- [x] 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`..
_(No permissions. It's a bug though.)_

**Dependencies**

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

**Documentation**

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

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

Adds a new "Pending Approval" filter to the MyAccount orders page,
allowing users to quickly filter orders that require their approval.

## How it works?

- New toggle filter: Added "Pending Approval" as the first filter option
in the orders filter slider
- Toggle switch: Users can turn on/off the filter to show only pending
approval orders
- URL integration: Filter state is reflected in the URL
(?pendingApproval=true)
- Selected tag: When active, shows "Pending my approval" tag below the
search bar

## How to test it?

- Go to /account/orders
- Open filter slider and verify "Pending Approval" is the first option
- Toggle the switch and click "Apply"
- Check URL - should include ?pendingApproval=true
- Verify tag appears - "Pending my approval" tag should show below
search bar
- Test removal - click "×" on tag or "Clear All" to remove filter
- Test direct URL - navigate to /account/orders?pendingApproval=true and
verify filter is active

## Starter deploy preview

vtex-sites/b2bfaststoredev.store#358

## References

[SFS-2618](https://vtex-dev.atlassian.net/browse/SFS-2618)

| List | Filter |
| - | - |
|
![image](https://github.com/user-attachments/assets/70a02298-4461-4b21-926d-8d6b754a78bc)
|
![image](https://github.com/user-attachments/assets/2d6afc76-7153-473a-b839-c141e4f0ca1f)
|

[SFS-2618]:

https://vtex-dev.atlassian.net/browse/SFS-2618?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

[SFS-2618]:
https://vtex-dev.atlassian.net/browse/SFS-2618?atlOrigin=eyJpIjoiNWRkNTljNzYxNjVmNDY3MDlhMDU5Y2ZhYzA5YTRkZjUiLCJwIjoiZ2l0aHViLWNvbS1KU1cifQ

---------

Co-authored-by: Artur Santiago <[email protected]>
)

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

Fix a bug that occurs when regionalized and `isSessionReady` is sent in
the' validateSession' and' validateCart' mutations.

## How does it work?

It removes the `isSessionReady` from the session sent to the `setRegion`
method.

<img width="1909" height="916" alt="Screenshot 2025-11-11 at 16 22 55"
src="https://github.com/user-attachments/assets/468cc987-a2ee-432f-b306-399bfd32e891"
/>
## What's the purpose of this pull request?

This PR aims to fix the build in the dev branch.
## What's the purpose of this pull request?

With these changes, a loading skeleton will be displayed when product
price is still being validated, preventing product price flickering on
PDP.

## How to test it?

### Starters Deploy Preview
## What's the purpose of this pull request?

Allow svg files in public folder, avoid it getting deleted/overwritten
when generating .faststore

## How it works?

Add it to the allow list.

## How to test it?

Create a svg file or modify an existing svg file, it should be copied
correctly to the `/.faststore/public` when running the build command.
You can use this PR to test:
vtex-sites/faststoreqa.store#887, I've added a
new svg file and changed an existing one, before it was being
deleted/overwritten.
<img width="287" height="420" alt="Screenshot 2025-11-20 at 09 57 19"
src="https://github.com/user-attachments/assets/7b01d806-bdf9-4c3b-a385-32ea11ab2518"
/>

Nothing else should change.

### Starters Deploy Preview

- https://storeframework-cm652ufll028lmgv665a6xv0g-h0max2o2h.b.vtex.app/

## References
- [Jira task](https://vtex-dev.atlassian.net/browse/SO-559)
## What's the purpose of this pull request?

This PR considers the session when deducing the changes to the orderForm
done externally.

## What it aims to solve

The current FastStore shows a competing nature when dealing with the
same cart on two different devices (E.g. 2 browsers, Chrome and
Firefox).

### How to reproduce the problem

- Open your store in Chrome and Firefox
- Make note of the checkout.vtex.com cookie value of Chrome and view the
content of the orderForm using a client like Postman
- Paste the value of the cookie to the checkout cookie of Firefox
- Now you should have the same orderForm in Chrome, Firefox and Postman
- Add an item to the cart from Chrome
- Without going to Firefox, verify that the item is present in the
orderForm using Postman
- Now go to Firefox, but you will not see the item (Expected: the item
should be present in the cart, Actual: the browser cart in Firefox will
override the items of the real orderForm object)
- Open Postman, and you will notice that the item is not present in the
orderForm
- Now go back to Chrome, and it will add back the item to the orderForm
- Open Postman, and you will notice that the item is present in the
orderForm

## How it works?

We include the session ID to the MD5 hash, so that when the store is
used in a different browser with the same orderForm, the two hashes are
different. The two browsers should respect the changes performed by each
other.

## How to test it?

- First verify that the existing behavior of the mutation `validateCart`
is as expected.
- Follow the steps under **How to reproduce the problem**, and verify
that the expected behavior is observed.

### 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)
## What's the purpose of this pull request?

This PR aims to fix the source code to show `undefined` `searchTerm`.
<img width="916" height="811" alt="Screenshot 2025-11-20 at 19 01 42"
src="https://github.com/user-attachments/assets/b07e44a4-9e37-45e3-9712-6ab19b1af758"
/>


## How it works?

1. The source code can't access the searchTerm from the build time;
thus, this page uses the default
<img width="1899" height="656" alt="Screenshot 2025-11-20 at 18 42 43"
src="https://github.com/user-attachments/assets/697d1b4a-e5cb-4325-a5a1-3ba5d429b7b3"
/>

2. The final code (runtime code after hydration, you can see the element
tab in the devtools), can access the dynamic search term and uses it.
<img width="1570" height="1049" alt="Screenshot 2025-11-20 at 18 42 05"
src="https://github.com/user-attachments/assets/04e0a613-950f-4416-9200-dcc239326b41"
/>

## How to test it?

You can run `pnpm build && pnpm serve` and view the source code
(right-click> Source Code). Additionally, you can view the final code
using the Element tab in the DevTools.
renatomaurovtex and others added 12 commits June 1, 2026 16:18
## Summary

Improves PLP LCP by making the browser fetch and prioritize the first
product card image earlier.

- **ProductListingPage**: render `<link rel="preload" as="image"
fetchPriority="high">` in `<Head>` for the first product image. The
preload URL is generated by `faststoreLoader` with `width=320` so it
exactly matches the `<img>` srcset selection at Lighthouse mobile (412px
viewport, DPR≈2, `sizes="30vw"` → 247px → next srcset step = 320). This
avoids a double fetch.
- **ProductGrid**: set `fetchPriority: 'high'` on the first card image,
and switch eager loading from `idx === 0` to `idx < 4` so the first
visible row is not blocked by lazy loading.
- **ProductCard**: forward `fetchPriority` from `imgProps` to the
underlying `Image` component.

This is the first slice of #3345.

## Context

PageSpeed Insights identifies the first product card image as the LCP
element on PLP even when a Hero section is present — the hero renders at
a smaller visual area than the first product card on mobile.

## Test plan

- [ ] Lighthouse mobile PLP run shows LCP element = first product image
and the preload reused (no `request not used` warning in DevTools).
- [ ] PLP renders correctly when `server.search.products.edges[0]` is
missing (no preload link rendered).
- [ ] Other PLPs and PDP unaffected.
- [ ] `pnpm test --filter=@faststore/core` passes.


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

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

## Summary by CodeRabbit

* **Performance Improvements**
* Optimized image loading on product listing pages with intelligent
priority handling to improve page load speed.
* First product images are now prioritized for faster initial rendering
on all devices.
* Product cards now support configurable image loading priority settings
for enhanced performance control.

<!-- 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/3348?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Cursor <[email protected]>
#3356)

When running cli the step of creating the .faststore folder was not
copying the discovery.config of the store because the
`createNextJsPages` trhow an error of use trying to create new nextjs
pages/apis that is not allowed.

The behaviour of not allowing is not changed, only kept the flow of
script as it was before fixing the config copy that was being steped in
this case.

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

## Summary by CodeRabbit

* **Refactor**
* Improved error handling and diagnostics in the initialization process
to ensure more accurate error reporting when setup encounters issues.

<!-- 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/3356?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
…3350)

## Summary

`useShouldFetchFirstPage` previously used `generatedBuildTime` as the
reference for the 5-minute refetch window. For static PLP pages served
hours or days after the build, the build-time check is always `true` on
the first client-side render, so the hook would refetch on every initial
navigation — defeating the cache injected by SSR.

This PR switches to a per-mount `pageLoadTime` ref (set on first render
via `useRef(Date.now())`) and only refetches once 5 minutes have elapsed
since the user actually opened the page. This matches the documented
intent ("don't refetch immediately after SSR injects the cache") and
removes the dependency on the build timestamp from
`usePageProductsQuery`.

Also reorders the hook body so `useRef` is called before the `page !==
0` early return, complying with the Rules of Hooks.

This is the third slice of #3345.

## Behavior changes

- First PLP visit no longer triggers a redundant client-side fetch right
after SSR.
- Subsequent refetch logic (after 5min) is unchanged in spirit, but
anchored to the user's session rather than the build.
- Public API of `useShouldFetchFirstPage` changes: the
`generatedBuildTime` parameter is removed. Only internal call site
(`usePageProductsQuery`) is updated; the hook is not part of the
documented SDK surface.

## Test plan

- [ ] On a fresh PLP load, the network panel shows only the SSR-injected
query, no immediate client refetch.
- [ ] After waiting 5 minutes and triggering a refetch (filter/sort
change), the first-page fetch happens.
- [ ] `pnpm test --filter=@faststore/core` passes (existing tests for
`useShouldFetchFirstPage` may need updates — flag if so).


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

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

## Summary by CodeRabbit

* **Refactor**
* Updated product data refresh logic to use client-side page load timing
instead of server-side build time for determining when to refetch the
first page, while maintaining the 5-minute refresh window.

<!-- 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/3350?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Cursor <[email protected]>
## What's the purpose of this pull request?

This PR fixes a class of issues where the generated
`<store>/.faststore/package.json` breaks local dev on consumer stores,
depending on the package manager / version manager the developer uses.

There are two distinct root causes, both stemming from how
`.faststore/package.json` is generated from `@faststore/core`'s
manifest:

1. **`packageManager` leak (Corepack / Yarn Berry).**
`@faststore/core`'s `package.json` declares `"packageManager":
"[email protected]"`. The CLI's `filterAndCopyPackageJson` only stripped
`exports`, so this field leaked into `.faststore/package.json`. Stores
running Yarn against `.faststore/` (via `yarn predev`, `yarn dev-only`,
`yarn build`, etc.) trip Corepack / Yarn Berry, which either refuses to
run or mangles the field into invalid strings like `yarn@[email protected]`.

2. **Missing `volta` pin (Volta resolves the wrong Yarn).** Volta
determines tool versions by walking up to the **nearest** `package.json`
and stops there — it does not keep climbing to inherit a parent's
`volta` config (that requires an explicit `volta.extends`). Since the
generated `.faststore/package.json` had no `volta` field, Volta users
running anything inside `.faststore/` (the `predev` step runs with `cwd
= .faststore`) fell back to their global Yarn — typically Yarn Berry
(4.x) — instead of the version pinned at the store root. Yarn Berry then
errors on the nested manifest:

> Usage Error: The nearest package directory (.../.faststore) doesn't
seem to be part of the project declared in ...

On top of that, this failure was hard to diagnose: the `predev` error
message was a copy-paste from the GraphQL codegen step (mentioning
GraphQL/TS, which is unrelated), and `runCommandSync` only surfaced the
underlying tool output when `DISCOVERY_DEBUG=true`, so store devs only
ever saw a generic, misleading message.

## How it works?

**Manifest generation (`packages/cli/src/utils/generate.ts`)**

- Extracts the filtering logic of `filterAndCopyPackageJson` into a pure
helper `buildFaststorePackageJson(coreManifest, voltaConfig?)`.
- The helper strips `packageManager` and `exports`, renames the package
to `dot-faststore`, and merges in the CLI-required scripts.
- Adds `readRootVoltaConfig(rootDir)`, which reads the `volta` field
from the **store root** `package.json` (when present) and returns
`undefined` otherwise, so stores that don't use Volta are unaffected.
- `filterAndCopyPackageJson` now resolves the store root via
`withBasePath(...).getRoot()`, reads its `volta` config, and forwards it
to the helper, which injects it into `.faststore/package.json`. This
keeps Volta pinned to the same Node/Yarn the store root declares.

**Surfacing the real error
(`packages/cli/src/utils/runCommandSync.ts`)**

- On failure, the tool's own output (stdout/stderr, already merged via
`2>&1`) is now **always** shown — not only under `DISCOVERY_DEBUG`. This
means store devs see the actual root cause (e.g. the Yarn Berry message,
which itself lists the possible fixes).

**Clearer `predev` message (`packages/cli/src/commands/dev.ts`)**

- Replaces the misleading GraphQL/TS message (duplicated from
`generate-graphql.ts`) with a concise one that states which step failed
and where, deferring details to the now-visible underlying output:

> The "predev" step ("<pm> predev") failed inside the ".faststore"
directory. See the error output below for details.

## Tests

- `packages/cli/src/utils/generate.test.ts`: existing coverage for
stripping `packageManager`/`exports`, the `dot-faststore` rename,
scripts merging, metadata preservation and input immutability; plus new
cases asserting the store `volta` config is propagated when provided and
omitted when absent.
…VTE-9) (#3349)

## Summary

Two related changes that reduce layout shift on PLP first paint.

- **ProductGallery**: replace `React.lazy(() =>
import('./ProductGalleryPage'))` with a static import of
`ProductGalleryPage`. The lazy chunk was loaded on the client after
hydration, so the gallery first rendered the Suspense fallback and then
swapped in the real content, producing a measurable CLS. Inlining the
gallery into the parent bundle removes the swap.
- **useScreenResize**: switch from `useEffect` to an isomorphic
`useLayoutEffect` (`useLayoutEffect` in the browser, `useEffect` during
SSR). The previous `useEffect` ran after the first paint, so mobile-only
branches first rendered with `isMobile=undefined` and then shifted once
the effect updated the state. `useLayoutEffect` runs synchronously
before paint, eliminating the shift.

This is the second slice of #3345.

## Notes for reviewers

- SonarQube flagged `useIsomorphicLayoutEffect` definition with a
`negated condition` warning and a `Prefer globalThis.window over window`
warning. Both are intentional — the negated form is the canonical
pattern from the React docs, and `window` (not `globalThis.window`) is
the convention used throughout the rest of the file. Happy to revisit if
reviewers prefer otherwise.

## Test plan

- [ ] PLP first paint CWV: CLS does not regress (Lighthouse mobile).
- [ ] PLP renders the full gallery on first paint (no Suspense fallback
flash).
- [ ] `useScreenResize` consumers continue to receive correct
`isMobile`/`isTablet`/`isDesktop` after window resize.
- [ ] `pnpm test --filter=@faststore/core` passes.


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

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

## Summary by CodeRabbit

* **Refactor**
* Improved component loading and rendering architecture for better
performance
  * Enhanced server-side rendering compatibility for layout operations

<!-- 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/3349?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->

<!-- end of auto-generated comment: release notes by coderabbit.ai -->

Co-authored-by: Cursor <[email protected]>
…utes (#3358)

## Problem

`validateLocaleForHostname` has three bugs that cause 404 on all SSR
pages when upgrading to FastStore v4:

### 1. Wrong config import
The function imports from `discovery.config.default.js` (FastStore
default config only) instead of `discovery.config` (merged default +
store config). All other utils in the same codebase use
`discovery.config`.

This means any locale bindings defined in the store's
`discovery.config.js` are completely ignored during validation.

### 2. `localization.enabled` flag not respected
When `localization.enabled: false`, the function still runs full
hostname/binding validation and returns `notFound: true` for any
non-localhost host.

All other functions in `bindingPaths.ts` correctly check
`!storeConfig.localization?.enabled` and return early —
`validateLocaleForHostname` was the only one missing this check.

### 3. `/pvt/` routes incorrectly validated
`withLocaleValidationSSR` is applied to all SSR pages including B2B
portal pages under `/pvt/`. These are private authenticated routes that
have no relationship to storefront locale routing and should never be
blocked by locale validation.

## Fix

1. **Import fix**: `discovery.config.default.js` → `discovery.config`
2. **enabled check**: Skip validation when `localization.enabled` is
`false`, consistent with `bindingPaths.ts`
3. **pvt bypass**: Skip locale validation for routes starting with
`/pvt/`

## Impact

Stores upgrading to v4 with `localization.enabled: false` (the default)
were getting 404 on all SSR pages (`/pvt/account`,
`/pvt/organization-account/...`, etc.) in any non-localhost environment.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

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

* **Bug Fixes**
* Locale validation now correctly short-circuits when localization is
disabled, preventing unnecessary validation and avoiding false
negatives.
* Locale validation is skipped for private/authenticated routes,
ensuring those requests proceed without hostname-based locale checks and
improving request handling for protected paths.

<!-- 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/3358?utm_source=github_walkthrough&utm_medium=github&utm_campaign=change_stack)

<!-- review_stack_entry_end -->
<!-- end of auto-generated comment: release notes by coderabbit.ai -->

---------

Co-authored-by: Claude Sonnet 4.6 <[email protected]>
<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes – v4.1.2

* **Bug Fixes**
* Improved locale validation handling when localization is disabled in
store configuration
* Fixed locale validation to correctly bypass validation for private
route paths

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
@hellofanny
hellofanny requested a review from a team as a code owner June 1, 2026 20:11
@hellofanny
hellofanny requested review from lemagnetic and lucasfp13 and removed request for a team June 1, 2026 20:11
@coderabbitai

coderabbitai Bot commented Jun 1, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Development release 4.2.0-dev.4 across all FastStore packages updates Node.js imports to node: specifiers, fixes Windows dynamic-import paths with file:// URLs, refactors localization into a dedicated settings module with race-condition handling in session initialization, disables refresh-token flow on localhost for development, optimizes product-listing LCP with image preloading, refactors first-page fetch timing to client-side page load, paginates Content Platform API with scroll cursors, adds CLI package.json builder tooling, and applies CSS flex/viewport refinements.

Changes

FastStore 4.2.0-dev.4 Release

Layer / File(s) Summary
Release metadata and version bumps
packages/*/CHANGELOG.md, packages/*/package.json
All packages (api, cli, components, core, diagnostics, lighthouse, sdk, storybook, ui) bumped to 4.2.0-dev.4 with changelog entries spanning 4.2.0-dev.0 through 4.2.0-dev.4.
Node.js built-in module specifier migration
packages/cli/src/commands/*.ts, packages/cli/src/utils/*.ts, packages/core/next.config.js, packages/core/src/server/index.ts, packages/core/src/utils/myAccountRedirect.tsx, packages/storybook/.storybook/main.ts
Systematic conversion from bare imports (fs, path, child_process, url) to node: prefixed specifiers across all CLI commands, utilities, core configuration, and storybook.
Dynamic import Windows path resolution via file:// URLs
packages/cli/src/commands/*.ts, packages/cli/src/utils/*.ts, packages/cli/src/utils/runCommandSync.ts
CLI modules updated to use pathToFileURL(...).href for dynamic import() calls (cache-graphql, cms-sync, config, generate, hcms, plugins); runCommandSync refactored to capture and pass precomputed output strings instead of debug-dependent error sanitization.
Localhost detection utility
packages/core/src/utils/isLocalHost.ts, packages/core/src/pages/api/graphql.ts, packages/core/src/pages/pvt/account/403.tsx, packages/core/src/sdk/account/useRefreshToken.ts, packages/core/test/utils/isLocalHost*.test.ts
New utility detecting localhost/127.0.0.1; server-side 403 page disables refresh-token on local requests; client-side useRefreshToken bypasses flow when running on localhost for smoother development experience.
Localization settings module refactoring
packages/core/src/sdk/localization/settings.ts, packages/core/src/sdk/localization/useLocalizationConfig.tsx
New settings.ts exports LocalizationSettings type and getSettings/getSettingsFromConfig helpers for URL-aware locale/currency/salesChannel derivation; useLocalizationConfig delegates settings logic to new module instead of inline implementation.
Session initialization race-condition fix
packages/core/src/sdk/session/initialSession.ts, packages/core/src/sdk/session/index.ts, packages/core/src/sdk/product/usePageProductsQuery.ts, packages/core/test/sdk/session/*.test.ts
New getInitialSession and installLocaleCorrector handlers seed session with URL-aware settings and fix IDB hydration races where stale persisted sessions override URL-derived locale/currency; includes safeParseChannel helper and comprehensive browser/server test coverage.
Largest Contentful Paint image optimization
packages/core/src/components/product/ProductCard/ProductCard.tsx, packages/core/src/components/product/ProductGrid/ProductGrid.tsx, packages/core/src/components/templates/ProductListingPage/ProductListingPage.tsx, packages/core/src/components/ui/Image/loader.ts
ProductCard forwards fetchPriority; ProductGrid marks first product as high priority and eager-loads first 4 items; ProductListingPage preloads first product's image via faststoreLoader; Image loader handles hyphenated VTEX product IDs.
First-page product fetch timing refactored
packages/core/src/sdk/product/useShouldFetchFirstPage.ts, packages/core/src/sdk/product/usePageProductsQuery.ts
generatedBuildTime removed; useShouldFetchFirstPage now tracks client-side page load via useRef(Date.now()), aligning five-minute fetch window with actual browser page load instead of build time.
Content Platform pagination and direct fetch optimization
packages/core/src/server/content/service.ts
getMultipleContent now paginates listEntries using scroll cursor, accumulates up to 25 pages, and hydrates entries; getPlpContent/getPdpContent attempt direct getSingleContent fetch first before falling back to multi-page selection.
CLI .faststore/package.json builder and tests
packages/cli/src/utils/generate.ts, packages/cli/src/utils/generate.test.ts
New exported buildFaststorePackageJson function and readRootVoltaConfig helper generate filtered .faststore/package.json by stripping exports/packageManager, pinning CLI scripts, and optionally propagating root volta config; comprehensive test suite validates behavior.
CSS flex alignment and viewport refinements
packages/core/src/components/account/MyAccountDrawer/OrganizationDrawer/section.module.scss, packages/ui/src/components/molecules/Toast/styles.scss, packages/ui/src/components/organisms/LocalizationSelector/styles.scss, packages/ui/src/components/organisms/SlideOver/styles.scss, packages/core/src/components/ui/ProductGallery/ProductGallery.tsx, packages/core/src/sdk/ui/useScreenResize.ts
Toast and LocalizationSelector flex alignment changed from start/end to flex-start/flex-end; SlideOver height changed from 100vh to 100dvh for dynamic viewport; ProductGallery switches from React.lazy to static import; useScreenResize uses isomorphic layout effect; predev error message improved.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~25 minutes

Possibly related PRs

  • vtex/faststore#3337: Windows/ESM path-loading fix using pathToFileURL for dynamic imports across the same CLI modules.
  • vtex/faststore#3281: Localization race-condition code changes (settings.ts, useLocalizationConfig, session initialization) and related test suites.
  • vtex/faststore#3348: LCP image optimization work (fetchPriority, eager loading, image preload in ProductListingPage).

Suggested labels

enhancement

Suggested reviewers

  • lemagnetic
  • lucasfp13

🎯 A dev release sweeps in—imports now prefixed node:,
Windows paths fixed with file:// URLs so smooth,
Localization race conditions tamed, refresh-token on localhost calmed,
LCP images preloaded bright, first-fetch timing fixed just right. ✨

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 38.24% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
Title check ✅ Passed The title 'feat: release version 2026 06 01' clearly describes a version release for June 1, 2026, which aligns with the changeset containing version bumps across all packages and changelog updates.

✏️ 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 release/version-2026-06-01

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

@codesandbox-ci

codesandbox-ci Bot commented Jun 1, 2026 •

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.

@hellofanny hellofanny changed the title Release/version 2026 06 01 Release: version 2026 06 01 Jun 1, 2026
@hellofanny hellofanny changed the title Release: version 2026 06 01 feat: release version 2026 06 01 Jun 1, 2026
@pkg-pr-new

pkg-pr-new Bot commented Jun 1, 2026

Copy link
Copy Markdown

Open in StackBlitz

@faststore/api

npm i https://pkg.pr.new/vtex/faststore/@faststore/api@6aaebad

@faststore/cli

npm i https://pkg.pr.new/vtex/faststore/@faststore/cli@6aaebad

@faststore/components

npm i https://pkg.pr.new/vtex/faststore/@faststore/components@6aaebad

@faststore/core

npm i https://pkg.pr.new/vtex/faststore/@faststore/core@6aaebad

@faststore/diagnostics

npm i https://pkg.pr.new/vtex/faststore/@faststore/diagnostics@6aaebad

@faststore/lighthouse

npm i https://pkg.pr.new/vtex/faststore/@faststore/lighthouse@6aaebad

@faststore/sdk

npm i https://pkg.pr.new/vtex/faststore/@faststore/sdk@6aaebad

@faststore/ui

npm i https://pkg.pr.new/vtex/faststore/@faststore/ui@6aaebad

commit: 6aaebad

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 6

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (2)
packages/core/src/server/content/service.ts (1)

84-111: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Fix directMatch typing and avoid empty-object short-circuit in CP content lookup

  • getSingleContent<T> / getFromCP<T> are typed as Promise<T>, but getFromCP’s not-found catch only logs and then falls through (no return), so it resolves undefined; this makes if (directMatch) effectively dead from TS’s point of view.
  • When slug/entryId are falsy (both PLP/PDP pages default slug to ''), getEntry routes to fetchFirstEntryFromList, which returns {} for empty lists—truthy—so PLP/PDP can short-circuit and skip the multi-page/template fallback instead of throwing MissingContentError.
🔒 Suggested type tightening
-  async getSingleContent<T extends ContentData>(
-    params: ContentParams
-  ): Promise<T> {
+  async getSingleContent<T extends ContentData>(
+    params: ContentParams
+  ): Promise<T | undefined> {
-  private async getFromCP<T extends ContentData>(
-    options: ContentOptions
-  ): Promise<T> {
+  private async getFromCP<T extends ContentData>(
+    options: ContentOptions
+  ): Promise<T | undefined> {

fetchFirstEntryFromList should also stop returning {} on “not found” (return undefined/null instead) so the runtime guard matches the updated types. Since getSingleContent is public, widening its return type needs sign-off.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/server/content/service.ts` around lines 84 - 111, The CP
content lookup functions are typed as returning Promise<T> but can resolve
undefined and fetchFirstEntryFromList returns an empty object (truthy), causing
incorrect short-circuits; change signatures for getSingleContent and getFromCP
to return Promise<T | undefined>, update getFromCP so its catch returns
undefined (not just logs), and modify fetchFirstEntryFromList to return
undefined/null when no entry found instead of {}. Then update callers that check
the result (e.g., getPdpContent/getPLP flow that uses directMatch and getEntry)
to handle the possibly undefined return (keeping the existing if (directMatch)
guards) and run tests to ensure MissingContentError still triggers when
appropriate.
packages/ui/package.json (1)

50-50: ⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Replace workspace:* with exact version for published package.

This package has publishConfig.access: public but uses workspace:* for the internal @faststore/components dependency. Published packages MUST specify exact internal versions (e.g., 4.2.0-dev.4) to ensure correct resolution for consumers.

🔧 Proposed fix
-    "`@faststore/components`": "workspace:*",
+    "`@faststore/components`": "4.2.0-dev.4",

As per coding guidelines: All packages MUST specify exact internal package versions (no workspace:* in published packages).

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/ui/package.json` at line 50, The dependency entry for
"`@faststore/components`" in packages/ui/package.json uses the placeholder
"workspace:*" which must be replaced with the actual published version string
(e.g., "4.2.0-dev.4"); update the "`@faststore/components`" value to the exact
semver you intend to publish, save package.json, and run your package manager to
update lockfiles so consumers resolve the correct internal version (note: this
package has publishConfig.access: public so exact versions are required).
🧹 Nitpick comments (2)
packages/core/src/sdk/localization/useLocalizationConfig.tsx (1)

71-72: ⚡ Quick win

Clarify the boolean expression.

!config.localization?.enabled === true is technically correct but reads awkwardly due to operator precedence. Simplifying improves readability.

✨ Suggested simplification
-  if (!config.localization?.enabled === true) {
+  if (!config.localization?.enabled) {
     return config.storeUrl
   }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/sdk/localization/useLocalizationConfig.tsx` around lines 71
- 72, The condition `!config.localization?.enabled === true` is confusing due to
operator precedence; replace it with a clearer boolean check in
useLocalizationConfig such as `if (!config.localization?.enabled) { return
config.storeUrl }` (or explicitly `if (config.localization?.enabled !== true) {
return config.storeUrl }`) to preserve behavior while improving readability;
update the conditional that references config.localization?.enabled accordingly.
packages/core/src/components/product/ProductGrid/ProductGrid.tsx (1)

192-194: ⚡ Quick win

Gate eager loading on the first page too.

fetchPriority is correctly scoped to idx === 0 && page === firstPage, but loading: idx < 4 ? 'eager' fires for every page taking this branch (desktop on all pages, mobile beyond page 0). On infinite-scroll appends those first-4 images are below the fold, so eager-loading them works against the LCP win you're chasing. Scope eager to the first page to keep later pages lazy.

♻️ Proposed change
-                      loading: idx < 4 ? 'eager' : 'lazy',
+                      loading:
+                        idx < 4 && page === firstPage ? 'eager' : 'lazy',
                       fetchPriority:
                         idx === 0 && page === firstPage ? 'high' : undefined,
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/components/product/ProductGrid/ProductGrid.tsx` around
lines 192 - 194, The eager-loading condition currently uses "loading: idx < 4 ?
'eager' : 'lazy'" which applies on every page; change it to also require the
first page so only images on the initial page are eager-loaded — update the
loading expression in ProductGrid (where idx, page, and firstPage are used) to
gate eager on page === firstPage && idx < 4, leaving the existing fetchPriority
(idx === 0 && page === firstPage) unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/api/CHANGELOG.md`:
- Line 8: Change the overly deep "### Bug Fixes" headings to "## Bug Fixes" so
the section level follows the H1 release header; search for the literal heading
string "### Bug Fixes" in CHANGELOG.md and replace each occurrence (including
the one near the release header and the one later in the file) with "## Bug
Fixes" to satisfy markdownlint MD001.

In `@packages/cli/CHANGELOG.md`:
- Line 8: Change the three subsection headings currently written as "### Bug
Fixes" (and the other two "###" headings at the same release block) to level-2
headings "##" so they are one level below the release heading; locate the
occurrences of "### Bug Fixes" (and the two other "###" subsection headings
noted) in CHANGELOG.md and replace the leading "###" with "##" to fix the MD001
violations.

In `@packages/components/CHANGELOG.md`:
- Line 8: Update the release subsection heading level in the CHANGELOG by
replacing the two occurrences of "### Bug Fixes" with "## Bug Fixes" so the
heading hierarchy is incremental; locate the "### Bug Fixes" headings in the
document (the ones around the release subsections) and change them to "## Bug
Fixes".

In `@packages/core/CHANGELOG.md`:
- Line 8: Change the top-level release subsection headers from H3 to H2 in the
changelog: replace the "###" prefixes with "##" for the headers named "Bug
Fixes" (and the other top-level release subsections referenced) so they use `##`
instead of `###`; locate and update the header lines matching "### Bug Fixes"
(and the other similar section titles on the file) to begin with `##` to satisfy
MD001.

In `@packages/core/src/sdk/localization/settings.ts`:
- Around line 21-24: The code currently accesses
config.localization.currencies[binding.currencyCode].symbol without checking
existence, which will throw if binding.currencyCode is missing or misconfigured;
update the currency object construction (symbol under currency) to first check
that config.localization.currencies[binding.currencyCode] exists and either use
a safe fallback symbol (e.g., empty string or a default from config) or throw a
clear, descriptive error mentioning binding.currencyCode; locate the currency
block where currency: { code: binding.currencyCode, symbol: ... } is built and
add the guard/read-with-fallback around
config.localization.currencies[binding.currencyCode].

In `@packages/core/src/server/content/service.ts`:
- Around line 55-71: The CP pagination loop (listEntries + scroll/ MAX_PAGES)
may sequentially call up to MAX_PAGES and the direct-match path can falsely
return an empty object; update the loop in service.ts (the do/while over
this.clientCP.listEntries and the MAX_PAGES guard) to early-stop once you have
sufficient entries for template selection (so you don't always drain to
MAX_PAGES) and consider lowering MAX_PAGES if appropriate; change getFromCP to
return Promise<T | undefined> and ensure the not-found branch returns undefined
(do not fall through), and change fetchFirstEntryFromList to return undefined
when entries is empty instead of returning {} so callers checking if
(directMatch) behave correctly; update any call sites (e.g., the direct match
check before fillEntriesWithData) to handle undefined results.

---

Outside diff comments:
In `@packages/core/src/server/content/service.ts`:
- Around line 84-111: The CP content lookup functions are typed as returning
Promise<T> but can resolve undefined and fetchFirstEntryFromList returns an
empty object (truthy), causing incorrect short-circuits; change signatures for
getSingleContent and getFromCP to return Promise<T | undefined>, update
getFromCP so its catch returns undefined (not just logs), and modify
fetchFirstEntryFromList to return undefined/null when no entry found instead of
{}. Then update callers that check the result (e.g., getPdpContent/getPLP flow
that uses directMatch and getEntry) to handle the possibly undefined return
(keeping the existing if (directMatch) guards) and run tests to ensure
MissingContentError still triggers when appropriate.

In `@packages/ui/package.json`:
- Line 50: The dependency entry for "`@faststore/components`" in
packages/ui/package.json uses the placeholder "workspace:*" which must be
replaced with the actual published version string (e.g., "4.2.0-dev.4"); update
the "`@faststore/components`" value to the exact semver you intend to publish,
save package.json, and run your package manager to update lockfiles so consumers
resolve the correct internal version (note: this package has
publishConfig.access: public so exact versions are required).

---

Nitpick comments:
In `@packages/core/src/components/product/ProductGrid/ProductGrid.tsx`:
- Around line 192-194: The eager-loading condition currently uses "loading: idx
< 4 ? 'eager' : 'lazy'" which applies on every page; change it to also require
the first page so only images on the initial page are eager-loaded — update the
loading expression in ProductGrid (where idx, page, and firstPage are used) to
gate eager on page === firstPage && idx < 4, leaving the existing fetchPriority
(idx === 0 && page === firstPage) unchanged.

In `@packages/core/src/sdk/localization/useLocalizationConfig.tsx`:
- Around line 71-72: The condition `!config.localization?.enabled === true` is
confusing due to operator precedence; replace it with a clearer boolean check in
useLocalizationConfig such as `if (!config.localization?.enabled) { return
config.storeUrl }` (or explicitly `if (config.localization?.enabled !== true) {
return config.storeUrl }`) to preserve behavior while improving readability;
update the conditional that references config.localization?.enabled accordingly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: 794798ac-348c-4ae6-aa72-a095dae0021e

📥 Commits

Reviewing files that changed from the base of the PR and between 59a328e and a561cd6.

⛔ Files ignored due to path filters (9)
  • .github/workflows/ci.yml is excluded by none and included by none
  • .github/workflows/packages-preview.yml is excluded by none and included by none
  • .vtex/catalog-info.yaml is excluded by none and included by none
  • AGENTS.md is excluded by none and included by none
  • CHANGELOG.md is excluded by none and included by none
  • biome.json is excluded by none and included by none
  • lerna.json is excluded by none and included by none
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml and included by none
  • scripts/set-resolution.js is excluded by none and included by none
📒 Files selected for processing (69)
  • packages/api/CHANGELOG.md
  • packages/api/package.json
  • packages/cli/CHANGELOG.md
  • packages/cli/package.json
  • packages/cli/src/commands/build.ts
  • packages/cli/src/commands/cache-graphql.ts
  • packages/cli/src/commands/cms-sync.ts
  • packages/cli/src/commands/dev.ts
  • packages/cli/src/commands/generate-i18n.ts
  • packages/cli/src/commands/start.ts
  • packages/cli/src/commands/test.ts
  • packages/cli/src/utils/commands.ts
  • packages/cli/src/utils/config.ts
  • packages/cli/src/utils/createNextjsPages.ts
  • packages/cli/src/utils/deprecations.ts
  • packages/cli/src/utils/directory.test.ts
  • packages/cli/src/utils/file.ts
  • packages/cli/src/utils/generate.test.ts
  • packages/cli/src/utils/generate.ts
  • packages/cli/src/utils/hcms.test.ts
  • packages/cli/src/utils/hcms.ts
  • packages/cli/src/utils/plugins.ts
  • packages/cli/src/utils/runCommandSync.ts
  • packages/components/CHANGELOG.md
  • packages/components/package.json
  • packages/core/CHANGELOG.md
  • packages/core/index.ts
  • packages/core/next.config.js
  • packages/core/package.json
  • packages/core/src/components/account/MyAccountDrawer/OrganizationDrawer/section.module.scss
  • packages/core/src/components/product/ProductCard/ProductCard.tsx
  • packages/core/src/components/product/ProductGrid/ProductGrid.tsx
  • packages/core/src/components/templates/ProductListingPage/ProductListingPage.tsx
  • packages/core/src/components/ui/Image/loader.ts
  • packages/core/src/components/ui/ProductGallery/ProductGallery.tsx
  • packages/core/src/pages/api/graphql.ts
  • packages/core/src/pages/pvt/account/403.tsx
  • packages/core/src/sdk/account/useRefreshToken.ts
  • packages/core/src/sdk/localization/settings.ts
  • packages/core/src/sdk/localization/useLocalizationConfig.tsx
  • packages/core/src/sdk/product/usePageProductsQuery.ts
  • packages/core/src/sdk/product/useShouldFetchFirstPage.ts
  • packages/core/src/sdk/session/index.ts
  • packages/core/src/sdk/session/initialSession.ts
  • packages/core/src/sdk/ui/useScreenResize.ts
  • packages/core/src/server/content/service.ts
  • packages/core/src/server/index.ts
  • packages/core/src/utils/isLocalHost.ts
  • packages/core/src/utils/localization/validateLocaleForHostname.ts
  • packages/core/src/utils/localization/withLocaleValidation.ts
  • packages/core/src/utils/myAccountRedirect.tsx
  • packages/core/test/sdk/session/getInitialSession.browser.test.ts
  • packages/core/test/sdk/session/installLocaleCorrector.browser.test.ts
  • packages/core/test/utils/isLocalHost.browser.test.ts
  • packages/core/test/utils/isLocalHost.test.ts
  • packages/diagnostics/CHANGELOG.md
  • packages/diagnostics/package.json
  • packages/lighthouse/CHANGELOG.md
  • packages/lighthouse/package.json
  • packages/sdk/CHANGELOG.md
  • packages/sdk/package.json
  • packages/storybook/.storybook/main.ts
  • packages/storybook/CHANGELOG.md
  • packages/storybook/package.json
  • packages/ui/CHANGELOG.md
  • packages/ui/package.json
  • packages/ui/src/components/molecules/Toast/styles.scss
  • packages/ui/src/components/organisms/LocalizationSelector/styles.scss
  • packages/ui/src/components/organisms/SlideOver/styles.scss
💤 Files with no reviewable changes (1)
  • packages/core/src/sdk/product/usePageProductsQuery.ts

Comment thread packages/api/CHANGELOG.md

# 4.2.0-dev.4 (2026-06-01)

### Bug Fixes

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Fix heading depth to satisfy markdownlint MD001.

At Line 8 and Line 22, ### Bug Fixes jumps a level after an H1 release header. Use ## Bug Fixes for these sections.

Also applies to: 22-22

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 8-8: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/api/CHANGELOG.md` at line 8, Change the overly deep "### Bug Fixes"
headings to "## Bug Fixes" so the section level follows the H1 release header;
search for the literal heading string "### Bug Fixes" in CHANGELOG.md and
replace each occurrence (including the one near the release header and the one
later in the file) with "## Bug Fixes" to satisfy markdownlint MD001.

Comment thread packages/cli/CHANGELOG.md
## [4.1.2](https://github.com/vtex/faststore/compare/v4.1.1...v4.1.2) (2026-06-01)
# 4.2.0-dev.4 (2026-06-01)

### Bug Fixes

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Adjust section headings to avoid MD001 violations.

At Line 8, Line 18, and Line 24, ### should be ## under the release heading level.

Also applies to: 18-18, 24-24

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 8-8: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/cli/CHANGELOG.md` at line 8, Change the three subsection headings
currently written as "### Bug Fixes" (and the other two "###" headings at the
same release block) to level-2 headings "##" so they are one level below the
release heading; locate the occurrences of "### Bug Fixes" (and the two other
"###" subsection headings noted) in CHANGELOG.md and replace the leading "###"
with "##" to fix the MD001 violations.


# 4.2.0-dev.4 (2026-06-01)

### Bug Fixes

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Normalize release subsection heading level.

At Line 8 and Line 22, use ## Bug Fixes instead of ### Bug Fixes to keep heading levels incremental.

Also applies to: 22-22

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 8-8: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/components/CHANGELOG.md` at line 8, Update the release subsection
heading level in the CHANGELOG by replacing the two occurrences of "### Bug
Fixes" with "## Bug Fixes" so the heading hierarchy is incremental; locate the
"### Bug Fixes" headings in the document (the ones around the release
subsections) and change them to "## Bug Fixes".

## [4.1.2](https://github.com/vtex/faststore/compare/v4.1.1...v4.1.2) (2026-06-01)
# 4.2.0-dev.4 (2026-06-01)

### Bug Fixes

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Use H2 for top-level release subsections.

At Line 8, Line 14, Line 24, and Line 31, section headers should be ## (not ###) to satisfy MD001.

Also applies to: 14-14, 24-24, 31-31

🧰 Tools
🪛 markdownlint-cli2 (0.22.1)

[warning] 8-8: Heading levels should only increment by one level at a time
Expected: h2; Actual: h3

(MD001, heading-increment)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/CHANGELOG.md` at line 8, Change the top-level release
subsection headers from H3 to H2 in the changelog: replace the "###" prefixes
with "##" for the headers named "Bug Fixes" (and the other top-level release
subsections referenced) so they use `##` instead of `###`; locate and update the
header lines matching "### Bug Fixes" (and the other similar section titles on
the file) to begin with `##` to satisfy MD001.

Comment on lines +21 to +24
currency: {
code: binding.currencyCode,
symbol: config.localization.currencies[binding.currencyCode].symbol,
},

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.

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Guard against missing currency configuration.

If binding.currencyCode isn't defined in config.localization.currencies, line 23 throws a TypeError. Consider a defensive check or a clearer error message when the currency is misconfigured.

🛡️ Suggested defensive check
   return {
     currency: {
       code: binding.currencyCode,
-      symbol: config.localization.currencies[binding.currencyCode].symbol,
+      symbol: config.localization.currencies[binding.currencyCode]?.symbol ?? '',
     },
     locale: configObject.code,
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
currency: {
code: binding.currencyCode,
symbol: config.localization.currencies[binding.currencyCode].symbol,
},
currency: {
code: binding.currencyCode,
symbol: config.localization.currencies[binding.currencyCode]?.symbol ?? '',
},
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/sdk/localization/settings.ts` around lines 21 - 24, The
code currently accesses
config.localization.currencies[binding.currencyCode].symbol without checking
existence, which will throw if binding.currencyCode is missing or misconfigured;
update the currency object construction (symbol under currency) to first check
that config.localization.currencies[binding.currencyCode] exists and either use
a safe fallback symbol (e.g., empty string or a default from config) or throw a
clear, descriptive error mentioning binding.currencyCode; locate the currency
block where currency: { code: binding.currencyCode, symbol: ... } is built and
add the guard/read-with-fallback around
config.localization.currencies[binding.currencyCode].

Comment on lines +55 to +71
do {
const result = await this.clientCP.listEntries(serviceParams, scroll)
allEntries.push(...result.entries)
const next = result.scroll ?? undefined
if (next && next === scroll) break
scroll = next
} while (scroll && ++pages < MAX_PAGES)

if (pages >= MAX_PAGES) {
console.warn('listEntries pagination hit MAX_PAGES cap', serviceParams)
}

return this.fillEntriesWithData(
allEntries,
serviceParams,
options.isPreview
)

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.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🌐 Web query:

@vtex/client-cp listEntries pagination scroll page size parameter

💡 Result:

For @vtex/client-cp, listEntries pagination/scroll/page-size parameters are NOT exposed as explicit “page/perPage/scroll page size” options in the public TypeScript definitions; listEntries returns a list plus hasNextPage/totalItems. 1) listEntries signature / pagination fields - listEntries is called with EntryPathParams containing: accountName, storeId, contentType, and optional entryId, slug, branchId, locale. [1] - The return type includes: entries, hasNextPage, totalItems. [1] 2) Page size parameter - In the public package typings, there is no pageSize/perPage/limit parameter shown for listEntries; therefore there is no supported “page size parameter” documented in the client-cp typings you referenced. [1] 3) Scroll parameter - The public package typings for listEntries do not show a “scroll” mode or scroll token parameter. What VTEX documents for “scroll” is for Master Data APIs (separate feature/endpoint): the scroll route returns a token in X-VTEX-MD-TOKEN and you pass it via a _token query parameter on subsequent requests. [2] Practical takeaway - If you only use @vtex/client-cp.listEntries, you should rely on the returned hasNextPage/totalItems and whatever internal paging the client/data-plane does; there is no exposed pageSize/scroll token parameter in the published typings. [1] - If you need true “scroll” semantics (token-based deep retrieval), that is documented for Master Data scroll APIs (not as part of client-cp.listEntries). [2]

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="packages/core/src/server/content/service.ts"
if [ ! -f "$FILE" ]; then
  echo "Missing file: $FILE" >&2
  exit 1
fi

echo "=== File line count ==="
wc -l "$FILE"

echo "=== Relevant sections (around loop) ==="
nl -ba "$FILE" | sed -n '1,220p'

echo "=== Remaining file ==="
nl -ba "$FILE" | sed -n '220,520p'

Repository: vtex/faststore

Length of output: 232


🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n "getPlpContent|getPdpContent|directMatch|getSingleContent|fetchFirstEntryFromList|getFromCP" packages/core/src/server/content/service.ts packages/core/src/server/content -S

Repository: vtex/faststore

Length of output: 2402


🏁 Script executed:

#!/bin/bash
set -euo pipefail

FILE="packages/core/src/server/content/service.ts"

echo "=== getSingleContent / getPlpContent / getPdpContent (lines 1-140) ==="
cat -n "$FILE" | sed -n '1,160p'

echo "=== getFromCP / fetchFirstEntryFromList + pagination (lines 120-260) ==="
cat -n "$FILE" | sed -n '120,260p'

echo "=== tail (lines 260-340) ==="
cat -n "$FILE" | sed -n '260,340p'

Repository: vtex/faststore

Length of output: 13515


Trim worst-case CP pagination cost and fix PLP/PDP direct-match short-circuit

The cycle-guard + MAX_PAGES cap make termination safe, but the current loop can still do up to 25 sequential listEntries calls on the PLP/PDP CP path; since @vtex/client-cp doesn’t expose a controllable page-size/scroll-token parameter in its typings, the main lever is reducing MAX_PAGES and/or early-stopping once enough entries exist for template selection (not always draining up to the cap).

Also, the “direct match” path can misbehave: getFromCP is typed Promise<T> but the not-found branch falls through without returning a value, and fetchFirstEntryFromList returns {} (truthy) when entries is empty—so if (directMatch) may return an empty object and skip the PLP/PDP fallback/template selection when slug/entryId aren’t present. Make these paths return T | undefined (or throw for non-optional content) and avoid returning {} as a stand-in.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/core/src/server/content/service.ts` around lines 55 - 71, The CP
pagination loop (listEntries + scroll/ MAX_PAGES) may sequentially call up to
MAX_PAGES and the direct-match path can falsely return an empty object; update
the loop in service.ts (the do/while over this.clientCP.listEntries and the
MAX_PAGES guard) to early-stop once you have sufficient entries for template
selection (so you don't always drain to MAX_PAGES) and consider lowering
MAX_PAGES if appropriate; change getFromCP to return Promise<T | undefined> and
ensure the not-found branch returns undefined (do not fall through), and change
fetchFirstEntryFromList to return undefined when entries is empty instead of
returning {} so callers checking if (directMatch) behave correctly; update any
call sites (e.g., the direct match check before fillEntriesWithData) to handle
undefined results.

@sonar-workflows

Copy link
Copy Markdown

@hellofanny
hellofanny merged commit 61fcbdf into main Jun 1, 2026
13 of 15 checks passed
@hellofanny
hellofanny deleted the release/version-2026-06-01 branch June 1, 2026 20:45
@coderabbitai coderabbitai Bot mentioned this pull request Jun 1, 2026
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.