feat: debounce quantity form per cart line item
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
- Navigate to Preview URL
- Add a product to cart
- Navigate to Cart
- Open network panel
- Rapidly increase the quantity of a cart line item by 10
- Notice only one POST request to /cart is logged in the network panel.
Migration
🚧 TODO
⚠️ No Changeset found
Latest commit: 3d8673232c1d4adeef27bf4a8f99333b5786384f
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
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 |
Is this something we still want to merge? Can we rebase if so?