Skip to content

Commit

Permalink
Prefetch the cart link immediately after add-to-cart (#716)
Browse files Browse the repository at this point in the history
  • Loading branch information
bookernath committed Mar 28, 2024
1 parent a1f7970 commit b1a2939
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/fresh-lemons-lick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@bigcommerce/catalyst-core": minor
---

Prefetch high-intent cart link immediately after add to cart action
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,12 @@ export const AddToCartForm = ({
{t.rich('addedProductQuantity', {
cartItems: quantity,
cartLink: (chunks) => (
<Link className="font-semibold text-primary" href="/cart">
<Link
className="font-semibold text-primary"
href="/cart"
prefetch="viewport"
prefetchKind="full"
>
{chunks}
</Link>
),
Expand Down
7 changes: 6 additions & 1 deletion apps/core/components/product-card/cart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,12 @@ export const Cart = ({ product }: { product: Partial<Product> }) => {
{t.rich('addedProductQuantity', {
cartItems: quantity,
cartLink: (chunks) => (
<Link className="font-semibold text-primary" href="/cart">
<Link
className="font-semibold text-primary"
href="/cart"
prefetch="viewport"
prefetchKind="full"
>
{chunks}
</Link>
),
Expand Down
7 changes: 6 additions & 1 deletion apps/core/components/product-form/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,12 @@ export const ProductForm = ({ product }: { product: Product }) => {
{t.rich('addedProductQuantity', {
cartItems: quantity,
cartLink: (chunks) => (
<Link className="font-semibold text-primary hover:text-secondary" href="/cart">
<Link
className="font-semibold text-primary hover:text-secondary"
href="/cart"
prefetch="viewport"
prefetchKind="full"
>
{chunks}
</Link>
),
Expand Down

0 comments on commit b1a2939

Please sign in to comment.