feat(core): add visual queues when cart update is pending#2564
feat(core): add visual queues when cart update is pending#2564
Conversation
🦋 Changeset detectedLatest commit: b368f40 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
3 Skipped Deployments
|
3256a07 to
a4c0bf6
Compare
matthewvolk
left a comment
There was a problem hiding this comment.
Everything works in the preview build as I'd expect it to. I can't think of any off the top of my head, but if there are any other interactions throughout the storefront that need this beforeunload behavior, maybe we consider turning this into a library to extract away some of the logic out of the primary cart logic.
| } | ||
| }; | ||
|
|
||
| if (isLineItemActionPending) { |
There was a problem hiding this comment.
🍹Is this needed if the handlers also check for it?
There was a problem hiding this comment.
Sorry, I missed this comment. I think so, we only want to add the event listeners if the action is pending. Now, this listener will only cleanup on the unmount, so we still need to check if the action is pending inside the callback.
What/Why?
Add visual queues when the cart state is being updated in the Cart page. Will also warn about pending state when trying to navigate away from page.
Kapture.2025-08-29.at.14.32.29.mp4
Testing
Locally.
Migration
/core/vibes/soul/sections/cart/client.tsxto include latest changes:isLineItemActionPendingto track when we need to disable checkout button and add a loading state.beforeunloadand when user tries to navigate using a link.lineItemActionPendingLabelto be able to pass in a translatable label to the window alert.