Skip to content

refactor: HostedCart component #771

@acasazza

Description

@acasazza

Summary

Refactor HostedCart.tsx to fix bugs and align with the patterns established in CheckoutLink and CartLink.

Changes

  • Fix Rules of Hooks violation — move all useContext calls above the early return null
  • Update JSDoc — replace deprecated <OrderContainer> with <Order>
  • Extract duplicated domain constant'commercelayer.io' hardcoded twice
  • Fix missing customDomain — second getApplicationLink call inside useEffect was not forwarding the prop
  • Extract shared cart URL resolver — deduplicate getOrganizationConfig + getApplicationLink logic
  • Fix useEffect dependency anti-pattern[ref.current != null] is not a valid dep array for iframe resizer setup
  • Replace .then() with async/await in the effect
  • Remove commented-out code// zIndex lines in default styles

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions