Skip to content

fix: Consider the session when finding orderForm changes - #3091

Merged
eduardoformiga merged 13 commits into
vtex:devfrom
clouda-inc:fix/cart-behavior
Nov 25, 2025
Merged

eduardoformiga merged 13 commits into
vtex:devfrom
clouda-inc:fix/cart-behavior

Conversation

@sahanljc

@sahanljc sahanljc commented Nov 3, 2025 •

Copy link
Copy Markdown
Contributor

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

References

Checklist

You may erase this after checking them all 😉

PR Title and Commit Messages

  • PR title and commit messages follow the Conventional Commits 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)

@codesandbox-ci

codesandbox-ci Bot commented Nov 3, 2025 •

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.

@sahanljc
sahanljc marked this pull request as ready for review November 3, 2025 13:19
@sahanljc
sahanljc requested a review from a team as a code owner November 3, 2025 13:19
@sahanljc
sahanljc requested review from lemagnetic and renatomaurovtex and removed request for a team November 3, 2025 13:19
@sahanljc sahanljc changed the title Consider the session when finding orderForm changes Bug: Consider the session when finding orderForm changes Nov 3, 2025
@sahanljc sahanljc changed the title Bug: Consider the session when finding orderForm changes Fix: Consider the session when finding orderForm changes Nov 3, 2025
@sahanljc sahanljc changed the title Fix: Consider the session when finding orderForm changes fix: Consider the session when finding orderForm changes Nov 3, 2025
* dev:
  [no ci] Release: 3.93.0-dev.0
  feat: Add RTL Support (vtex#3097)
  [no ci] Release: 3.92.1-dev.0
  chore: release (vtex#3096)
  [no ci] Release: 3.92.0
  feat: release (vtex#3092)
* dev:
  [no ci] Release: 3.93.0-dev.2
  fix(ui): update slider variable for border-radius in the mozilla rules (vtex#3077)
  [no ci] Release: 3.93.0-dev.1
  fix: Handle empty footer logo scenario (vtex#3094)
* dev:
  feat: add filter and selected tag for pending my approval (vtex#3001) (vtex#3101)
@sahanljc

Copy link
Copy Markdown
Contributor Author

@lemagnetic Hi, would you be able to review this PR and provide your feedback please? Thanks.

* dev:
  fix: validateSession error when isSessionReady is sent - SFS-2944 (vtex#3115)
@sahanljc

sahanljc commented Nov 13, 2025 •

Copy link
Copy Markdown
Contributor Author

@eduardoformiga I see that the work related to #3001, #3101 has caused GraphQL build errors in the main DEV branch. Do we know how to fix that?

* dev:
  [no ci] Release: 3.93.0-dev.4
  fix: Show skeleton when product price is validating (vtex#3112)
  [no ci] Release: 3.93.0-dev.3
  fix: build among diff modules (vtex#3119)
* dev:
  [no ci] Release: 3.94.1-dev.0
  [no ci] Release: 3.94.0
  feat: update version to 3.93.0-dev.4 and clean up changelogs (vtex#3127)
  feat: release version 20251119 17 05 (vtex#3126)
  feat: Trigger build
  [no ci] Release: 3.93.0
  Trigger build
  feat: release version 20251118 (vtex#3121)
  [no ci] Release: 3.93.0
  feat: RTL (vtex#3098)
* dev:
  [no ci] Release: 3.95.0-dev.0
  feat: Add svg extension to public folder copy's allow list (vtex#3123)

@eduardoformiga eduardoformiga left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Wow, good job! I've tested it, and it works as expected.
Just left one small suggestion before we go ahead 😉

Nov-24-2025 18-13-23

@eduardoformiga
eduardoformiga merged commit b5cfb55 into vtex:dev Nov 25, 2025
sahanljc added a commit to clouda-inc/faststore that referenced this pull request Nov 25, 2025
* dev:
  fix: Consider the session when finding orderForm changes (vtex#3091)
thiagopereira-vtex pushed a commit that referenced this pull request Jan 8, 2026
## 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)
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.

2 participants