Skip to content

Adopt Hydrogen cart form primitives - #522

Merged
laugharn merged 1 commit into
release/2026-08-23-hydrogenfrom
feat/hydrogen-cart-forms
Aug 23, 2026
Merged

laugharn merged 1 commit into
release/2026-08-23-hydrogenfrom
feat/hydrogen-cart-forms

Conversation

@laugharn

Copy link
Copy Markdown
Collaborator

Summary

  • create typed cart React bindings from the installed Hydrogen server handlers
  • migrate quantity, remove, and discount mutations to useCartForm()
  • share native line forms between the cart overlay, cart page, and agent cart summary
  • use Hydrogen's attached quantity inputs and sanitize direct edits to the supported 0–99 range
  • remove the custom line-update and discount event adapters
  • document the remaining compatibility boundary

Compatibility boundary

Add-to-cart still uses the existing /api/cart event bridge because the installed Hydrogen preview's add-form path cannot preserve both behaviors this template needs:

  • gift-card line attributes are dropped by the form payload parser
  • optimistic product detail cannot be attached, leaving incomplete optimistic lines

The agent's server-cart synchronization bridge also remains because those mutations already happened server-side and must be applied to the client store without replaying them.

Verification

  • focused oxlint — passed, 0 warnings/errors
  • ./node_modules/.bin/tsc --noEmit — passed
  • pnpm build — passed; Next.js compiled successfully and generated 32/32 pages
  • runtime smoke test — HTTP 200 for /cart
  • cart handler smoke test — HTTP 200 for GET /api/cart with a valid cart envelope
  • git diff --check — passed

@vercel

vercel Bot commented Aug 23, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
shop-docs Ready Ready Preview, v0 Aug 23, 2026 4:44pm
shop-template Ready Ready Preview, v0 Aug 23, 2026 4:44pm

@laugharn
laugharn marked this pull request as ready for review August 23, 2026 16:47
@laugharn
laugharn changed the base branch from main to release/2026-08-23-hydrogen August 23, 2026 17:10
@laugharn
laugharn merged commit 83e85ed into release/2026-08-23-hydrogen Aug 23, 2026
7 checks passed
@laugharn
laugharn deleted the feat/hydrogen-cart-forms branch September 18, 2026 21:56

This branch was successfully deployed

2 active deployments
Preview – shop-docs — 2d7b3922 Deployed Aug 23, 2026 by vercel[bot]
Preview – shop-template — 2d7b3922 Deployed Aug 23, 2026 by vercel[bot]
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