Skip to content

fix(ep-commerce): the two 0.4.0 regressions the tests were defending - #447

Merged
field123 merged 2 commits into
masterfrom
worktree-ep-438-followups
Aug 20, 2026
Merged

fix(ep-commerce): the two 0.4.0 regressions the tests were defending#447
field123 merged 2 commits into
masterfrom
worktree-ep-438-followups

Conversation

@field123

Copy link
Copy Markdown
Collaborator

Two fixes #438 left behind, both of which passed the suite while breaking production.

EPCheckoutCartField read a checkoutCartData selector nothing provides, and its item branch read imageUrl/formattedPrice off a line that now carries image.href/meta.display_price. It resolves against the cart published by EPCheckoutCartSummary, through the same resolver EPCartField and EPCartItemField use, so saved choices keep working. MOCK_CHECKOUT_CART_DATA was also still the old flat shape while being published as cart, so the canvas and EPOrderTotalsBreakdown's cart source read zeros.

findChildProduct returned the first child whenever the choices resolved to none, so a renamed option in Commerce Manager or a stale saved selection showed the shopper a different variant at a different price. It returns undefined; both callers already treat that as no-match.

Stale checkout money. Three memos formatting totals, order summaries and shipping rates closed over currencyDisplay and locale without depending on them, as did a fourth site in EPCheckoutProvider. Both are bindable props on EpCommerceProvider, so a designer-wired switcher left every checkout total formatted as first rendered. A bound useMoneyFormat replaces the closure.

The stale-money tests pin their selector data to a stable object — a fresh one per render re-runs the memo whatever its dependencies are, which is how this passed a green suite.

The extension-path half of this work landed separately in #443; this branch was rebased onto it.

The component still read a `checkoutCartData` selector nothing provides, and its
item branch still read `imageUrl` and `formattedPrice` off a line that now
carries `image.href` and `meta.display_price`. It resolves against the `cart`
published by EPCheckoutCartSummary through the same field-value resolver
EPCartField and EPCartItemField use, so the saved choices keep working.

MOCK_CHECKOUT_CART_DATA was still the old flat shape while being published as
`cart`, so the canvas and EPOrderTotalsBreakdown's cart source both read zeros.

Repoints the two tests that encoded the removed shapes and adds the tests
EPCheckoutCartField never had — the bug passed the suite while breaking
production.
… the checkout money going stale

findChildProduct returned the first child whenever the choices did not resolve
to one, so a renamed option in Commerce Manager or a stale saved selection put
a different variant at a different price in front of the shopper. It returns
undefined; both callers already treat that as no-match, and
registerEPProductVariantPicker was already refusing to call it on a partial
selection.

The three memos that format checkout money called fmt() in their bodies while
omitting currencyDisplay and locale from their dependencies — as did a fourth
site, EPCheckoutProvider's checkoutData memo. Both values are bindable props on
EpCommerceProvider, so a designer-wired switcher left every checkout total
formatted as first rendered. A bound useMoneyFormat replaces the closure: the
memos depend on the formatter, which they cannot silently omit, and the
triplicated defaulting goes with it.

The stale-money tests pin the selector data to a stable object. A fresh one per
render re-runs the memo whatever its dependencies are, which is how this passed
a green suite.
@field123
field123 merged commit 3040701 into master Aug 20, 2026
9 checks passed
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.

1 participant