fix
This commit is contained in:
32
components/3d/ClientStatsWrapper.tsx
Normal file
32
components/3d/ClientStatsWrapper.tsx
Normal file
@@ -0,0 +1,32 @@
|
||||
"use client";
|
||||
|
||||
import { Suspense, useEffect } from 'react';
|
||||
import dynamic from 'next/dynamic';
|
||||
|
||||
// Dynamically import the 3D stats component
|
||||
const StatsSection = dynamic(() => import('./StatsSection'), {
|
||||
ssr: false,
|
||||
loading: () => <div className="h-40 w-full bg-gray-900 animate-pulse rounded-lg"></div>
|
||||
});
|
||||
|
||||
export default function ClientStatsWrapper({ stats }: { stats: any }) {
|
||||
// Debug the stats to see what's being passed
|
||||
useEffect(() => {
|
||||
console.log('Stats data received in client component:', stats);
|
||||
}, [stats]);
|
||||
|
||||
// Apply defaults if stats is undefined
|
||||
const safeStats = stats || {
|
||||
totalProducts: 0,
|
||||
totalVendors: 0,
|
||||
totalOrders: 0,
|
||||
totalCustomers: 0,
|
||||
gmv: 0
|
||||
};
|
||||
|
||||
return (
|
||||
<Suspense fallback={<div className="h-40 w-full bg-gray-900 animate-pulse rounded-lg"></div>}>
|
||||
<StatsSection stats={safeStats} />
|
||||
</Suspense>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user