Skip to content

feat(core): add visual queues when cart update is pending#2564

Merged
jorgemoya merged 2 commits intocanaryfrom
cart-page-loading
Sep 3, 2025
Merged

feat(core): add visual queues when cart update is pending#2564
jorgemoya merged 2 commits intocanaryfrom
cart-page-loading

Conversation

@jorgemoya
Copy link
Copy Markdown
Contributor

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

  1. Update /core/vibes/soul/sections/cart/client.tsx to include latest changes:
  • Use isLineItemActionPending to track when we need to disable checkout button and add a loading state.
  • Add skeletons to checkout summary fields that will update when the pending state is complete.
  • Add side effects to handle when a user beforeunload and when user tries to navigate using a link.
  • Add prop to lineItemActionPendingLabel to be able to pass in a translatable label to the window alert.
  1. Add label to dictionary of choice.

@jorgemoya jorgemoya requested a review from a team August 29, 2025 19:38
@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Aug 29, 2025

🦋 Changeset detected

Latest commit: b368f40

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@bigcommerce/catalyst-core Patch

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

@vercel
Copy link
Copy Markdown

vercel Bot commented Aug 29, 2025

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

Project Deployment Preview Comments Updated (UTC)
catalyst-b2b Ready Ready Preview Comment Sep 2, 2025 7:01pm
catalyst-canary Ready Ready Preview Comment Sep 2, 2025 7:01pm
3 Skipped Deployments
Project Deployment Preview Comments Updated (UTC)
catalyst Ignored Ignored Sep 2, 2025 7:01pm
catalyst-au Ignored Ignored Sep 2, 2025 7:01pm
catalyst-uk Ignored Ignored Sep 2, 2025 7:01pm

Copy link
Copy Markdown
Contributor

@matthewvolk matthewvolk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🍹Is this needed if the handlers also check for it?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jorgemoya jorgemoya added this pull request to the merge queue Sep 3, 2025
Merged via the queue into canary with commit 69797a4 Sep 3, 2025
13 checks passed
@jorgemoya jorgemoya deleted the cart-page-loading branch September 3, 2025 15:16
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.

2 participants