Skip to content

Conversation

@hellofanny
Copy link
Contributor

@hellofanny hellofanny commented Jan 14, 2026

What's the purpose of this pull request?

Infinite loop occurred when validating cart when:

  • User was logged in (sessionId present)
  • postalCode was set (regionalization active)
  • Adding items in cart
  • cartEtag changing all the time

You can try simulate the problem here

How it works?

  • Change getOrderFormEtag to filter only fields that indicate real cart changes.
  • ShippingData verification before early return null: Previously, we returned null immediately when changes.length === 0, ignoring potential need to update shippingData, now we ensures shippingData is updated when necessary (If no changes in the items, but shippingData need to be updated, we update only the shippingData, avoiding inconsistent states.

Scenarios that I've tested:

  1. The default one (user logged in + postalCode set)
  2. Changing postalCode
testing_fix_changin_postalCode.mov
  1. Adding a item that is unavailable (more than one)
testing-no-item.mov

Starters Deploy Preview

preview link

  1. Simulates login (using lunellifs acc)
  2. Adds a postalCode
  3. Adds any item to the cart, try to add more than one.
    The items should be updating according in the card.

References

eduardoformiga and others added 2 commits January 13, 2026 23:47
- Added logic to check if shippingData needs to be updated based on session information.
- Improved flow to return null only if there are no item changes and no shipping updates required.
- Separated item updates and shipping data updates for better clarity and performance.
@hellofanny hellofanny requested a review from a team as a code owner January 14, 2026 03:54
@hellofanny hellofanny requested review from eduardoformiga and renatamottam and removed request for a team January 14, 2026 03:54
@coderabbitai
Copy link

coderabbitai bot commented Jan 14, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


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

@codesandbox-ci
Copy link

codesandbox-ci bot commented Jan 14, 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 force-pushed the fix/validate-cart-loop-shipping-simulation-1 branch from 95c10d2 to 3e060ef Compare January 14, 2026 04:03
@hellofanny hellofanny requested review from renatomaurovtex and removed request for renatamottam January 14, 2026 04:26
@hellofanny hellofanny self-assigned this Jan 14, 2026
@hellofanny hellofanny added the bug Something isn't working label Jan 14, 2026
@hellofanny hellofanny merged commit 41bc64b into main Jan 14, 2026
10 of 11 checks passed
@hellofanny hellofanny deleted the fix/validate-cart-loop-shipping-simulation-1 branch January 14, 2026 14:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants