Skip to content

Improve cart loading and error UI handling #1520

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

Merged
merged 2 commits into from
Jul 3, 2025
Merged
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
11 changes: 7 additions & 4 deletions components/Cart/CartContents.vue
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
<template>
<div v-if="isLoading">
<div v-if="isLoading && cartItems.length === 0">
<h2 class="mt-64 text-3xl text-center">Loading cart...</h2>
</div>
<div v-else-if="error">
<div v-else-if="error && cartItems.length === 0">
<h2 class="mt-64 text-3xl text-center text-red-500">
Error loading cart. Please try again.
</h2>
</div>
<div v-else-if="cartItems.length">
<h1 class="h-10 p-6 text-3xl font-bold text-center">Cart</h1>
<section class="mt-10">
<h1 class="h-10 p-6 text-3xl font-bold text-center">
Cart
<span v-if="isLoading" class="text-sm text-gray-500 ml-2">(updating...)</span>
</h1>
<section class="mt-10" :class="{ 'opacity-70': isLoading }">
<CartItem
v-for="product in cartItems"
:key="product.key"
Expand Down