Skip to content

🐛 fix(HostedCart): refresh minicart URL when persistKey changes — v5 port (#740)#741

Merged
acasazza merged 7 commits intov5.0.0from
v5/fix/hosted-cart-pr740
Apr 9, 2026
Merged

🐛 fix(HostedCart): refresh minicart URL when persistKey changes — v5 port (#740)#741
acasazza merged 7 commits intov5.0.0from
v5/fix/hosted-cart-pr740

Conversation

@acasazza
Copy link
Copy Markdown
Member

@acasazza acasazza commented Apr 9, 2026

Changes

Port of PR #740 onto the v5.0.0 branch.

🐛 Fix: HostedCart — refresh minicart URL when persistKey changes (Closes #685)

  • Added loadedOrderIdRef to track which order ID the current src was built for
  • Added persistKey to useEffect dependency array so the cart URL recomputes when the storage key changes
  • Fixed setOrder org-config lookup to use order?.id ?? orderId consistently
  • Added regression test in specs/orders/hosted-cart.spec.tsx

📦 Deps: bump @commercelayer/organization-config to ^2.8.4

  • Unlocks new ConfigParams fields: identityType, clientId, scope, returnUrl, resetPasswordUrl, skuListId, skuId, lang, token

✨ Feat: MyIdentityLink — pass all identity params to getOrganizationConfig

  • Forwards identityType, clientId, scope, returnUrl, resetPasswordUrl
  • Moved getDomain(endpoint) inside the useEffect callback to keep deps clean
  • Fixed useEffect dependency array to include all consumed props

✨ Feat: AddToCartButton — pass skuListId and skuId to getOrganizationConfig

  • Enables org-config URL templates with :sku_list_id and :sku_id placeholders to resolve correctly

♻️ Refactor: HostedCart — resolve order ID once via resolvedOrderId

  • Extracted order?.id ?? localStorage.getItem(persistKey) into a single resolvedOrderId variable

Note: version bump commits from the original PR were intentionally skipped. The @commercelayer/sdk version conflict (PR used ^6.x, v5 uses ^7.x) was resolved by keeping the v5 SDK version.

@acasazza acasazza added the bug Something isn't working label Apr 9, 2026
@acasazza acasazza self-assigned this Apr 9, 2026
@acasazza acasazza added the bug Something isn't working label Apr 9, 2026
@acasazza acasazza merged commit 0c59772 into v5.0.0 Apr 9, 2026
2 checks passed
@acasazza acasazza deleted the v5/fix/hosted-cart-pr740 branch April 9, 2026 10:38
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.

1 participant