From ebb07c40fca0271bf836d1445342f292a8cede7b Mon Sep 17 00:00:00 2001 From: Rami Bitar Date: Sat, 15 Aug 2026 16:58:14 -0400 Subject: [PATCH] Show loading skeletons instead of empty state when product or collection is missing Co-Authored-By: Claude Opus 5 Claude-Session: https://claude.ai/code/session_01DoqTD6MbXbwpCofyqwvELd --- components/shopify/collection-detail.tsx | 7 +++-- components/shopify/product-detail/index.tsx | 32 ++------------------- 2 files changed, 7 insertions(+), 32 deletions(-) diff --git a/components/shopify/collection-detail.tsx b/components/shopify/collection-detail.tsx index 70e8db2..c43b6da 100644 --- a/components/shopify/collection-detail.tsx +++ b/components/shopify/collection-detail.tsx @@ -160,7 +160,10 @@ const CollectionDetail: React.FC = ({
- {loading ? ( + {/* A missing or failed collection keeps the skeletons up rather than + showing an empty state, so the page stays presentable while a + handle is being chosen. */} + {loading || error ? (
{Array.from({ length: 10 }).map((_, index) => (
@@ -172,8 +175,6 @@ const CollectionDetail: React.FC = ({
))}
- ) : error ? ( -

{error}

) : products.length === 0 ? (

{activeFilters.length > 0 diff --git a/components/shopify/product-detail/index.tsx b/components/shopify/product-detail/index.tsx index 4c83938..7bae902 100644 --- a/components/shopify/product-detail/index.tsx +++ b/components/shopify/product-detail/index.tsx @@ -6,14 +6,6 @@ import { useProduct, type Product } from '@/hooks/use-shopify-products'; import { useShopifyCart, redirectToCheckout } from '@/hooks/use-shopify-cart'; import ProductDetailGallery from './product-detail-gallery'; import ProductDetailInfo from './product-detail-info'; -import { Button } from '@/components/ui/button'; -import { - Empty, - EmptyHeader, - EmptyTitle, - EmptyDescription, - EmptyContent, -} from '@/components/ui/empty'; interface ProductVariant { id: string; @@ -142,7 +134,9 @@ const ProductDetail: React.FC = ({ } }; - if (loading) { + // A missing or failed product keeps the skeletons up rather than showing an + // empty state, so the page stays presentable while a handle is being chosen. + if (loading || error || !product) { return (

@@ -168,26 +162,6 @@ const ProductDetail: React.FC = ({ ); } - if (error || !product) { - return ( -
- - - Product Not Found - - {error || 'The requested product could not be found.'} - - - - - - -
- ); - } - return (