Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefetch the cart link immediately after add-to-cart #716

Merged
merged 1 commit into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading