Skip to content

fix: defer setOrder to avoid render-phase state update warning - #630

Merged
marco-commercelayer merged 2 commits into
mainfrom
fix/render-phase-set-order
Jul 8, 2026
Merged

fix: defer setOrder to avoid render-phase state update warning#630
marco-commercelayer merged 2 commits into
mainfrom
fix/render-phase-set-order

Conversation

@acasazza

@acasazza acasazza commented Jul 8, 2026

Copy link
Copy Markdown
Member

What

  • AppProvider.getOrder: OrderContainer (from @commercelayer/react-components) invokes the getOrder callback during render, so calling setOrder synchronously triggered React's "Cannot update a component while rendering a different component" warning. The state update is now deferred with setTimeout(..., 0); orderRef is still set synchronously so consumers reading the ref are unaffected.
  • CheckoutPage.ts (e2e fixture): replaced the fixed mouse.wheel(0, 300) scroll with a conditional one — the Stripe payment tab lives in a cross-origin iframe, so Playwright can't auto-scroll the outer page for it. The fixture now measures the tab's bounding box and scrolls only when it's below the fold, just enough to bring it into view.

Why

The render-phase setState warning polluted the console on every order load and can mask real issues. The blind 300px scroll made the Stripe tab click flaky depending on viewport size and page layout.

🤖 Generated with Claude Code

acasazza and others added 2 commits July 7, 2026 19:03
OrderContainer invokes the fetchOrder callback during render, so
updating AppProvider state synchronously triggers React's "cannot
update a component while rendering a different component" warning.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Playwright can't auto-scroll the outer page for elements inside the
cross-origin Stripe iframe, so scroll manually only when the tab is
below the fold instead of always wheeling by a fixed amount.
@acasazza acasazza self-assigned this Jul 8, 2026
@acasazza acasazza added the bug Something isn't working label Jul 8, 2026
@marco-commercelayer
marco-commercelayer self-requested a review July 8, 2026 08:49
@marco-commercelayer
marco-commercelayer merged commit 81db498 into main Jul 8, 2026
5 checks passed
@malessani

Copy link
Copy Markdown
Contributor

🎉 This PR is included in version 6.5.4 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

@acasazza
acasazza deleted the fix/render-phase-set-order branch July 8, 2026 09:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants