Skip to content

v5.0.4 - #846

Merged
acasazza merged 1 commit into
mainfrom
version
Sep 16, 2026
Merged

v5.0.4#846
acasazza merged 1 commit into
mainfrom
version

Conversation

@acasazza

Copy link
Copy Markdown
Member

Version bump to 5.0.4 across the three packages, on top of #845.

What ships

OrderList no longer refetches in a loop. It fired a fetch roughly once per API round-trip, through two independent routes that each had to be closed:

  • useCustomerProviderValue memoized the whole context value with state among its deps and spread ...state into it, so every landed fetch produced a new getCustomerOrders identity — and OrderList has that callback in its effect deps. It is now a stable actions memo plus a thin outer memo joining state and actions, with the one callback that read state.addresses directly going through a ref. The callbacks still change identity when accessToken or customerId change, so a fetch still reruns when the token arrives.
  • defaultSdkSorting was a bare object literal — a new identity every render, which refired the effect even once the callbacks were stable. Now memoized on the primitives it derives from.

CommerceLayer hands out a stable context value. The provider wrapped its value in an object literal, giving every consumer a fresh identity on every render. This provider sits at the root of the tree and consumers put its values into effect dependency arrays: it was the amplifier behind the refetch loop rather than its cause, and it stayed a trap for anything else downstream. The five other providers built from object literals are deliberately left alone — three sit inside .map() callbacks where the value is a single loop variable, and the other two are narrow leaf contexts. None of them wraps the app.

Two props stop leaking onto DOM elements. BillingAddressForm declared fieldEvent in Props but never destructured it, so it survived into the rest spread landing on the <form> and React warned about it; ShippingAddressForm already did this correctly, which is what makes it an omission rather than a decision. Address leaked disabledClassName the same way.

CI now runs the tests

Nothing in CI ran them. The check reading "test / test" comes from merge-test-env-check.yml, whose test job only lists licenses — three seconds, passing regardless of the code. The 1376 tests across the three packages ran only in the local pre-commit hook, so a PR that broke them showed all green.

The new workflow is named unit-tests with a vitest job, so it cannot be mistaken for the licenses check next to it. pnpm test is not reused: the react-components script starts with pnpm audit --prod --audit-level high, which fails on any newly published advisory and would turn the suite red for reasons unrelated to the change. Lint and vitest run directly instead, after a build — react-hooks-components' lint script ends in tsc, which resolves @commercelayer/core-components through its dist/, absent on a clean checkout.

🤖 Generated with Claude Code

@acasazza acasazza added the ignore-for-release Ignore this issue or pull request from release notes label Sep 16, 2026
@acasazza acasazza self-assigned this Sep 16, 2026
@netlify

netlify Bot commented Sep 16, 2026

Copy link
Copy Markdown

Deploy Preview for commercelayer-react-components ready!

Name Link
🔨 Latest commit d0a9348
🔍 Latest deploy log https://app.netlify.com/projects/commercelayer-react-components/deploys/6aaabb367b8edf000844cfd1
😎 Deploy Preview https://deploy-preview-846--commercelayer-react-components.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@acasazza
acasazza merged commit 250ac6e into main Sep 16, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ignore-for-release Ignore this issue or pull request from release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants