Skip to content

Conversation

matthewvolk
Copy link
Contributor

What/Why?

The updateLineItem server action can be spammed pretty easily due to the fact that we are optimistically updating the cart line items in response to increment, decrement, and delete actions. Quantity updates were a good candidate for debouncing, which is exactly what this PR adds. With that said, this PR does not fix the fact that users can still spam delete actions on line items. That will need to be a fix for another PR.

Important

This PR changes the CounterForm component pretty drastically. For one, it removes the HTML <form> entirely. When reviewing this PR, we should weigh the impact of decisions like that, I'd be interested in hearing everyone's thoughts.

Fixes #2476

Testing

  1. Navigate to Preview URL
  2. Add a product to cart
  3. Navigate to Cart
  4. Open network panel
  5. Rapidly increase the quantity of a cart line item by 10
  6. Notice only one POST request to /cart is logged in the network panel.

Migration

🚧 TODO

@matthewvolk matthewvolk requested a review from a team as a code owner July 18, 2025 21:32
Copy link

changeset-bot bot commented Jul 18, 2025

⚠️ No Changeset found

Latest commit: 3d86732

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

Copy link

vercel bot commented Jul 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
catalyst-canary ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jul 18, 2025 9:32pm
4 Skipped Deployments
Name Status Preview Comments Updated (UTC)
catalyst ⬜️ Ignored (Inspect) Jul 18, 2025 9:32pm
catalyst-au ⬜️ Ignored (Inspect) Jul 18, 2025 9:32pm
catalyst-b2b ⬜️ Ignored (Inspect) Jul 18, 2025 9:32pm
catalyst-uk ⬜️ Ignored (Inspect) Jul 18, 2025 9:32pm

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.

Many requests when changing quantity in cart
1 participant