Skip to content

A modern and elegant dashboard for network traffic visualization and analysis.

feat: Implement skeleton loading states for dashboard data widgets and introduce a `ClientOnly` component.

luolei30308bc2d6ca
diff --git a/apps/web/app/[locale]/dashboard/components/content/index.tsx b/apps/web/app/[locale]/dashboard/components/content/index.tsx
index 3b47663..1abc81a 100644
--- a/apps/web/app/[locale]/dashboard/components/content/index.tsx
+++ b/apps/web/app/[locale]/dashboard/components/content/index.tsx
@@ -42,6 +42,7 @@ interface ContentProps {
activeBackendId?: number;
backendStatus: BackendStatus;
onNavigate?: (tab: string) => void;
+ isLoading?: boolean;
}
// Overview Content Component
@@ -55,6 +56,7 @@ const OverviewContent = memo(function OverviewContent({
activeBackendId,
onNavigate,
backendStatus,
+ isLoading,
}: {
data: StatsSummary | null;
countryData: CountryStats[];
@@ -65,10 +67,16 @@ const OverviewContent = memo(function OverviewContent({
activeBackendId?: number;
onNavigate?: (tab: string) => void;
backendStatus: BackendStatus;
+ isLoading?: boolean;
}) {
return (
<div className="space-y-6">
- <StatsCards data={data} error={error} backendStatus={backendStatus} />
+ <StatsCards
+ data={data}
+ error={error}
+ backendStatus={backendStatus}
+ isLoading={isLoading}
+ />
<OverviewTab
domains={data?.topDomains || []}
proxies={data?.proxyStats || []}
@@ -79,6 +87,7 @@ const OverviewContent = memo(function OverviewContent({
activeBackendId={activeBackendId}
onNavigate={onNavigate}
backendStatus={backendStatus}
+ isLoading={isLoading}
/>
</div>
);
diff --git a/apps/web/app/[locale]/dashboard/components/header/index.tsx b/apps/web/app/[locale]/dashboard/components/header/index.tsx
index 28f41c3..97f05f0 100644
--- a/apps/web/app/[locale]/dashboard/components/header/index.tsx
+++ b/apps/web/app/[locale]/dashboard/components/header/index.tsx
@@ -39,7 +39,7 @@ import {
PopoverTrigger,
} from "@/components/ui/popover";
import { Switch } from "@/components/ui/switch";
-import { TimeRangePicker, LanguageSwitcher, ThemeToggle } from "@/components/common";
+import { TimeRangePicker, LanguageSwitcher, ThemeToggle, ClientOnly } from "@/components/common";
import { cn } from "@/lib/utils";
import type { TimeRange } from "@/lib/api";
import type { BackendStatus, TimePreset } from "@/lib/types/dashboard";
@@ -282,11 +282,13 @@ export function Header({
{/* Desktop: Language & Theme */}
<div className="hidden sm:flex items-center gap-1">
- <TimeRangePicker
- value={timeRange}
- onChange={onTimeRangeChange}
- showcaseMode={isShowcase}
- />
+ <ClientOnly fallback={<div className="h-9 w-[152px] bg-secondary/45 rounded-xl" />}>
+ <TimeRangePicker
+ value={timeRange}
+ onChange={onTimeRangeChange}
+ showcaseMode={isShowcase}
+ />
+ </ClientOnly>
<LanguageSwitcher />
<ThemeToggle />
@@ -305,12 +307,14 @@ export function Header({
{/* Mobile: Time range picker */}
<div className="sm:hidden">
- <TimeRangePicker
- value={timeRange}
- onChange={onTimeRangeChange}
- className="w-[122px]"
- showcaseMode={isShowcase}
- />
+ <ClientOnly fallback={<div className="h-9 w-[122px] bg-secondary/45 rounded-xl" />}>
+ <TimeRangePicker
+ value={timeRange}
+ onChange={onTimeRangeChange}
+ className="w-[122px]"
+ showcaseMode={isShowcase}
+ />
+ </ClientOnly>
</div>
{/* Mobile: Backend warning in top actions */}
diff --git a/apps/web/app/[locale]/dashboard/hooks/use-dashboard.ts b/apps/web/app/[locale]/dashboard/hooks/use-dashboard.ts
index 208e9be..7e1aa2f 100644
--- a/apps/web/app/[locale]/dashboard/hooks/use-dashboard.ts
+++ b/apps/web/app/[locale]/dashboard/hooks/use-dashboard.ts
@@ -62,6 +62,7 @@ export interface UseDashboardReturn {
queryError: string | null;
wsConnected: boolean;
wsRealtimeActive: boolean;
+ isLoading: boolean;
// Actions
setActiveTab: (tab: TabId) => void;
@@ -366,6 +367,7 @@ export function useDashboard(): UseDashboardReturn {
queryError,
wsConnected,
wsRealtimeActive,
+ isLoading: summaryQuery.isLoading || (backendsQuery.isLoading && !backends.length),
// Actions
setActiveTab,
diff --git a/apps/web/app/[locale]/dashboard/page.tsx b/apps/web/app/[locale]/dashboard/page.tsx
index bfd00fc..9ba844f 100644
--- a/apps/web/app/[locale]/dashboard/page.tsx
+++ b/apps/web/app/[locale]/dashboard/page.tsx
@@ -30,6 +30,7 @@ export default function DashboardPage() {
backendStatus,
backendStatusHint,
queryError,
+ isLoading,
// Actions
setActiveTab,
@@ -98,6 +99,7 @@ export default function DashboardPage() {
error={queryError}
timeRange={timeRange}
timePreset={timePreset}
+ isLoading={isLoading}
autoRefresh={autoRefresh}
activeBackendId={activeBackendId}
backendStatus={backendStatus}
diff --git a/apps/web/components/common/client-only.tsx b/apps/web/components/common/client-only.tsx
new file mode 100644
index 0000000..abf6535
--- /dev/null
+++ b/apps/web/components/common/client-only.tsx
@@ -0,0 +1,29 @@
+"use client";
+
+import { useEffect, useState, type ReactNode } from "react";
+
+interface ClientOnlyProps {
+ children: ReactNode;
+ fallback?: ReactNode;
+ className?: string; // Allow passing className to wrapper if needed (though we return children directly)
+}
+
+/**
+ * A component that only renders its children on the client side.
+ * This is useful for components that rely on browser-specific APIs (like window, localStorage)
+ * or dynamic data that differs between server and client (like Date.now()),
+ * which would otherwise cause HTML hydration mismatches.
+ */
+export function ClientOnly({ children, fallback = null }: ClientOnlyProps) {
+ const [isMounted, setIsMounted] = useState(false);
+
+ useEffect(() => {
+ setIsMounted(true);
+ }, []);
+
+ if (!isMounted) {
+ return <>{fallback}</>;
+ }
+
+ return <>{children}</>;
+}
diff --git a/apps/web/components/common/index.ts b/apps/web/components/common/index.ts
index 48d4ec1..2cf75e5 100644
--- a/apps/web/components/common/index.ts
+++ b/apps/web/components/common/index.ts
@@ -8,3 +8,4 @@ export { ThemeToggle } from "./theme-toggle";
export { TimeRangePicker } from "./time-range-picker";
export { TopListItem } from "./top-list-item";
export { OverviewCard } from "./overview-card";
+export { ClientOnly } from "./client-only";
diff --git a/apps/web/components/features/stats/charts/trend-chart.tsx b/apps/web/components/features/stats/charts/trend-chart.tsx
index 34d7b18..54d7043 100644
--- a/apps/web/components/features/stats/charts/trend-chart.tsx
+++ b/apps/web/components/features/stats/charts/trend-chart.tsx
@@ -1,6 +1,6 @@
"use client";
-import React, { useMemo } from "react";
+import React, { useMemo, useRef } from "react";
import {
AreaChart,
Area,
@@ -42,6 +42,12 @@ export const TrafficTrendChart = React.memo(
}: TrafficTrendChartProps) {
const t = useTranslations("trend");
const chartT = useTranslations("chart");
+
+ // Track if we've ever received data to avoid showing empty state on initial load
+ const hasEverReceivedData = useRef(false);
+ if (data.length > 0) {
+ hasEverReceivedData.current = true;
+ }
const selectorOptions = useMemo(() => {
const allOptions: { value: TimeRange; label: string }[] = [
@@ -165,15 +171,64 @@ export const TrafficTrendChart = React.memo(
[chartT, t, granularity],
);
- // If no data, show empty state
- if (!isLoading && chartData.length === 0) {
+ // Loading skeleton - show when loading or on initial load with no data yet
+ // This prevents flickering from empty state to skeleton on first load
+ if ((isLoading && chartData.length === 0) || (chartData.length === 0 && !hasEverReceivedData.current)) {
return (
<Card className="h-full">
<CardHeader className="pb-2">
- <CardTitle className="text-sm font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2">
- <Activity className="w-4 h-4" />
- {t("title")}
- </CardTitle>
+ <div className="flex items-center justify-between flex-wrap gap-3">
+ <CardTitle className="text-sm font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2">
+ <Activity className="w-4 h-4" />
+ {t("title")}
+ </CardTitle>
+ <div className="h-7 w-[168px] bg-muted/50 rounded-lg animate-pulse hidden lg:block" />
+ </div>
+ <div className="hidden lg:flex items-center gap-6 mt-3">
+ <div className="h-4 w-24 bg-muted/50 rounded animate-pulse" />
+ <div className="h-4 w-24 bg-muted/50 rounded animate-pulse" />
+ <div className="h-4 w-24 bg-muted/50 rounded animate-pulse ml-auto" />
+ </div>
+ <div className="grid grid-cols-3 gap-2 mt-2 lg:hidden">
+ <div className="h-10 bg-muted/50 rounded animate-pulse" />
+ <div className="h-10 bg-muted/50 rounded animate-pulse" />
+ <div className="h-10 bg-muted/50 rounded animate-pulse" />
+ </div>
+ </CardHeader>
+ <CardContent>
+ <div className="h-[200px] w-full bg-muted/20 rounded-xl animate-pulse flex items-end justify-between px-4 pb-4 gap-2">
+ {/* Use fixed heights to avoid hydration mismatch between SSR and client */}
+ {[35, 62, 28, 75, 45, 58, 32, 68, 40, 55, 30, 65].map((height, i) => (
+ <div key={i} className="w-full bg-muted/40 rounded-t" style={{ height: `${height}%` }} />
+ ))}
+ </div>
+ </CardContent>
+ </Card>
+ );
+ }
+
+ // If no data and we've previously received data, show empty state
+ // Otherwise (initial load with no data), keep showing skeleton to avoid flickering
+ if (!isLoading && chartData.length === 0 && hasEverReceivedData.current) {
+ return (
+ <Card className="h-full">
+ <CardHeader className="pb-2">
+ <div className="flex items-center justify-between flex-wrap gap-3">
+ <CardTitle className="text-sm font-semibold text-muted-foreground uppercase tracking-wider flex items-center gap-2">
+ <Activity className="w-4 h-4" />
+ {t("title")}
+ </CardTitle>
+ {/* Maintain height of selector */}
+ <div className="h-7 w-[168px] hidden lg:block" />
+ </div>
+
+ {/* Maintain height of stats row */}
+ <div className="hidden lg:flex items-center gap-6 mt-3 opacity-0 pointer-events-none" aria-hidden="true">
+ <div className="h-4 w-24" />
+ </div>
+ <div className="grid grid-cols-3 gap-2 mt-2 lg:hidden opacity-0 pointer-events-none" aria-hidden="true">
+ <div className="h-10" />
+ </div>
</CardHeader>
<CardContent>
<div className="h-[200px] rounded-xl border border-dashed border-border/60 bg-card/20 flex flex-col items-center justify-center text-center px-4">
diff --git a/apps/web/components/features/stats/stats-cards.tsx b/apps/web/components/features/stats/stats-cards.tsx
index e86b5f4..861e86f 100644
--- a/apps/web/components/features/stats/stats-cards.tsx
+++ b/apps/web/components/features/stats/stats-cards.tsx
@@ -4,13 +4,14 @@ import { useRef, useEffect } from "react";
import { Download, Upload, Globe, Activity, Server, Route } from "lucide-react";
import { useTranslations } from "next-intl";
import { motion, useSpring, useTransform, useMotionValue } from "framer-motion";
-import { formatBytes } from "@/lib/utils";
+import { formatBytes, cn } from "@/lib/utils";
import type { StatsSummary } from "@neko-master/shared";
interface StatsCardsProps {
data: StatsSummary | null;
error?: string | null;
backendStatus?: "healthy" | "unhealthy" | "unknown";
+ isLoading?: boolean;
}
// ---------- Animated number display ----------
@@ -96,7 +97,7 @@ function AnimatedStatCard({
// ---------- Main ----------
-export function StatsCards({ data, backendStatus }: StatsCardsProps) {
+export function StatsCards({ data, backendStatus, isLoading }: StatsCardsProps) {
const t = useTranslations("stats");
const summaryIsZero =
!data ||
@@ -112,14 +113,16 @@ export function StatsCards({ data, backendStatus }: StatsCardsProps) {
icon: Icon,
label,
color,
+ shimmer = false,
}: {
icon: React.ElementType;
label: string;
color: string;
+ shimmer?: boolean;
}) => (
<div className="rounded-xl p-3.5 border bg-card shadow-xs flex flex-col">
<div
- className="w-8 h-8 rounded-md flex items-center justify-center mb-2.5 animate-pulse"
+ className={cn("w-8 h-8 rounded-md flex items-center justify-center mb-2.5", shimmer && "animate-pulse")}
style={{ backgroundColor: `${color}15` }}>
<Icon className="w-4 h-4" style={{ color }} />
</div>
@@ -127,16 +130,37 @@ export function StatsCards({ data, backendStatus }: StatsCardsProps) {
<p className="text-muted-foreground text-[11px] uppercase tracking-[0.14em] font-medium truncate">
{label}
</p>
- <p className="text-lg leading-none font-semibold mt-2.5 tabular-nums text-muted-foreground">
- --
- </p>
- <p className="text-[11px] text-muted-foreground mt-1.5 truncate">
- {t("unavailable")}
- </p>
+ {shimmer ? (
+ <div className="h-5 w-24 bg-muted/50 rounded mt-2.5 mb-1 animate-pulse" />
+ ) : (
+ <p className="text-lg leading-none font-semibold mt-2.5 tabular-nums text-muted-foreground">
+ --
+ </p>
+ )}
+ {shimmer ? (
+ <div className="h-3 w-12 bg-muted/30 rounded mt-1.5 animate-pulse" />
+ ) : (
+ <p className="text-[11px] text-muted-foreground mt-1.5 truncate">
+ {t("unavailable")}
+ </p>
+ )}
</div>
</div>
);
+ if (isLoading) {
+ return (
+ <div className="grid gap-2.5 grid-cols-2 sm:grid-cols-3 lg:grid-cols-6">
+ <PlaceholderStatCard icon={Download} label={t("totalDownload")} color="#3B82F6" shimmer />
+ <PlaceholderStatCard icon={Upload} label={t("totalUpload")} color="#8B5CF6" shimmer />
+ <PlaceholderStatCard icon={Server} label={t("total")} color="#EC4899" shimmer />
+ <PlaceholderStatCard icon={Activity} label={t("totalConnections")} color="#10B981" shimmer />
+ <PlaceholderStatCard icon={Globe} label={t("domains")} color="#06B6D4" shimmer />
+ <PlaceholderStatCard icon={Route} label={t("rules")} color="#F59E0B" shimmer />
+ </div>
+ );
+ }
+
return (
<div className="grid gap-2.5 grid-cols-2 sm:grid-cols-3 lg:grid-cols-6">
{showUnavailablePlaceholder ? (
diff --git a/apps/web/components/overview/index.tsx b/apps/web/components/overview/index.tsx
index ffdaaa6..9415ade 100644
--- a/apps/web/components/overview/index.tsx
+++ b/apps/web/components/overview/index.tsx
@@ -34,6 +34,7 @@ interface OverviewTabProps {
autoRefresh?: boolean;
onNavigate?: (tab: string) => void;
backendStatus?: "healthy" | "unhealthy" | "unknown";
+ isLoading?: boolean;
}
const THIRTY_MINUTES_MS = 30 * 60 * 1000;
@@ -101,6 +102,7 @@ export function OverviewTab({
autoRefresh = true,
onNavigate,
backendStatus = "unknown",
+ isLoading,
}: OverviewTabProps) {
const dashboardT = useTranslations("dashboard");
const queryClient = useQueryClient();
@@ -218,7 +220,7 @@ export function OverviewTab({
const wsTrendConnected = wsTrendStatus === "connected";
// Use the new hook for data fetching
- const { data: trendData, isLoading: trendLoading } = useTrafficTrend({
+ const { data: trendData, isLoading: trendLoading, isFetching: trendFetching } = useTrafficTrend({
activeBackendId,
minutes: trendQuery.minutes,
bucketMinutes: trendQuery.bucketMinutes,
@@ -277,7 +279,7 @@ export function OverviewTab({
timeRange={canUseTrendSelector ? trendTimeRange : undefined}
timeRangeOptions={trendTimeOptions}
onTimeRangeChange={canUseTrendSelector ? handleTimeRangeChange : undefined}
- isLoading={trendLoading}
+ isLoading={isLoading || trendLoading || (trendFetching && (!trendData || trendData.length === 0))}
emptyHint={backendStatus === "unhealthy" ? dashboardT("backendUnavailableHint") : undefined}
/>
@@ -288,6 +290,7 @@ export function OverviewTab({
sortBy={domainSort}
onSortChange={setDomainSort}
onViewAll={() => onNavigate?.("domains")}
+ isLoading={isLoading}
/>
{/* Top Proxies */}
@@ -296,6 +299,7 @@ export function OverviewTab({
sortBy={proxySort}
onSortChange={setProxySort}
onViewAll={() => onNavigate?.("proxies")}
+ isLoading={isLoading}
/>
{/* Top Countries */}
@@ -304,6 +308,7 @@ export function OverviewTab({
sortBy={countrySort}
onSortChange={setCountrySort}
onViewAll={() => onNavigate?.("countries")}
+ isLoading={isLoading}
/>
</div>
</div>
diff --git a/apps/web/components/overview/top-countries-simple.tsx b/apps/web/components/overview/top-countries-simple.tsx
index 99cd65e..1e179d6 100644
--- a/apps/web/components/overview/top-countries-simple.tsx
+++ b/apps/web/components/overview/top-countries-simple.tsx
@@ -13,6 +13,7 @@ interface TopCountriesSimpleProps {
sortBy: "traffic" | "connections";
onSortChange: (mode: "traffic" | "connections") => void;
onViewAll?: () => void;
+ isLoading?: boolean;
}
const countryNamesEn: Record<string, string> = {
@@ -47,6 +48,7 @@ export const TopCountriesSimple = React.memo(function TopCountriesSimple({
sortBy,
onSortChange,
onViewAll,
+ isLoading,
}: TopCountriesSimpleProps) {
const t = useTranslations("topCountries");
const locale = useLocale();
@@ -181,7 +183,35 @@ export const TopCountriesSimple = React.memo(function TopCountriesSimple({
</div>
</div>
);
- }) : (
+ }) : isLoading ? (
+ // Skeleton loading state - 6 items with 2 rows each to match actual content height
+ Array.from({ length: 6 }).map((_, i) => (
+ <div
+ key={i}
+ className="p-2.5 rounded-xl border border-border/50 bg-card/50"
+ >
+ {/* Row 1: Rank + Flag + Name + Total - mb-1.5 like real data */}
+ <div className="flex items-center gap-2 mb-1.5">
+ <div className="w-5 h-5 rounded-md bg-muted/60 animate-pulse shrink-0" />
+ <div className="w-5 h-[14px] rounded bg-muted/60 animate-pulse shrink-0" />
+ <div className="flex-1 h-4 bg-muted/60 rounded animate-pulse" />
+ <div className="w-12 h-4 bg-muted/60 rounded animate-pulse shrink-0" />
+ </div>
+ {/* Row 2: Progress bar + Stats placeholder - space-y-1.5 like real data */}
+ <div className="pl-7 space-y-1.5">
+ <div className="h-1.5 rounded-full bg-muted/60 animate-pulse" />
+ <div className="flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <div className="w-14 h-3 bg-muted/60 rounded animate-pulse" />
+ <div className="w-14 h-3 bg-muted/60 rounded animate-pulse" />
+ <div className="w-10 h-3 bg-muted/60 rounded animate-pulse" />
+ </div>
+ <div className="w-8 h-3 bg-muted/60 rounded animate-pulse" />
+ </div>
+ </div>
+ </div>
+ ))
+ ) : (
<div className="h-full min-h-[220px] rounded-xl border border-dashed border-border/60 bg-card/30 px-4 py-5">
<div className="space-y-2">
{[0, 1, 2].map((item) => (
diff --git a/apps/web/components/overview/top-domains-simple.tsx b/apps/web/components/overview/top-domains-simple.tsx
index 7ca9a30..5323ffb 100644
--- a/apps/web/components/overview/top-domains-simple.tsx
+++ b/apps/web/components/overview/top-domains-simple.tsx
@@ -13,6 +13,7 @@ interface TopDomainsSimpleProps {
sortBy: "traffic" | "connections";
onSortChange: (mode: "traffic" | "connections") => void;
onViewAll?: () => void;
+ isLoading?: boolean;
}
function getInitials(domain: string): string {
@@ -24,6 +25,7 @@ export const TopDomainsSimple = React.memo(function TopDomainsSimple({
sortBy,
onSortChange,
onViewAll,
+ isLoading,
}: TopDomainsSimpleProps) {
const t = useTranslations("topDomains");
const { settings } = useSettings();
@@ -164,7 +166,29 @@ export const TopDomainsSimple = React.memo(function TopDomainsSimple({
</div>
</div>
);
- }) : (
+ }) : isLoading ? (
+ // Skeleton loading state - 6 items with 2 rows each to match actual content height
+ Array.from({ length: 6 }).map((_, i) => (
+ <div
+ key={i}
+ className="p-2.5 rounded-xl border border-border/50 bg-card/50"
+ >
+ {/* Row 1: Rank + Icon + Name + Total */}
+ <div className="flex items-center gap-2">
+ <div className="w-5 h-5 rounded-md bg-muted/60 animate-pulse shrink-0" />
+ <div className="w-5 h-5 rounded bg-muted/60 animate-pulse shrink-0" />
+ <div className="flex-1 h-4 bg-muted/60 rounded animate-pulse" />
+ <div className="w-12 h-4 bg-muted/60 rounded animate-pulse shrink-0" />
+ </div>
+ {/* Row 2: Stats placeholder to match actual height - use mt-1 like real data */}
+ <div className="pl-7 mt-1 flex items-center gap-2">
+ <div className="w-16 h-3 bg-muted/60 rounded animate-pulse" />
+ <div className="w-16 h-3 bg-muted/60 rounded animate-pulse" />
+ <div className="w-12 h-3 bg-muted/60 rounded animate-pulse" />
+ </div>
+ </div>
+ ))
+ ) : (
<div className="h-full min-h-[220px] rounded-xl border border-dashed border-border/60 bg-card/30 px-4 py-5">
<div className="space-y-2">
{[0, 1, 2].map((item) => (
diff --git a/apps/web/components/overview/top-proxies-simple.tsx b/apps/web/components/overview/top-proxies-simple.tsx
index 607e2a2..33d5c9d 100644
--- a/apps/web/components/overview/top-proxies-simple.tsx
+++ b/apps/web/components/overview/top-proxies-simple.tsx
@@ -13,6 +13,7 @@ interface TopProxiesSimpleProps {
sortBy: "traffic" | "connections";
onSortChange: (mode: "traffic" | "connections") => void;
onViewAll?: () => void;
+ isLoading?: boolean;
}
function simplifyProxyName(name: string): string {
@@ -30,6 +31,7 @@ export const TopProxiesSimple = React.memo(
sortBy,
onSortChange,
onViewAll,
+ isLoading,
}: TopProxiesSimpleProps) {
const t = useTranslations("topProxies");
const isWindows = useIsWindows();
@@ -186,7 +188,34 @@ export const TopProxiesSimple = React.memo(
</div>
</div>
);
- }) : (
+ }) : isLoading ? (
+ // Skeleton loading state - 6 items with 2 rows each to match actual content height
+ Array.from({ length: 6 }).map((_, i) => (
+ <div
+ key={i}
+ className="p-2.5 rounded-xl border border-border/50 bg-card/50"
+ >
+ {/* Row 1: Rank + Name + Total - mb-1.5 like real data */}
+ <div className="flex items-center gap-2 mb-1.5">
+ <div className="w-5 h-5 rounded-md bg-muted/60 animate-pulse shrink-0" />
+ <div className="flex-1 h-4 bg-muted/60 rounded animate-pulse" />
+ <div className="w-12 h-4 bg-muted/60 rounded animate-pulse shrink-0" />
+ </div>
+ {/* Row 2: Progress bar + Stats placeholder - space-y-1.5 like real data */}
+ <div className="pl-7 space-y-1.5">
+ <div className="h-1.5 rounded-full bg-muted/60 animate-pulse" />
+ <div className="flex items-center justify-between">
+ <div className="flex items-center gap-2">
+ <div className="w-14 h-3 bg-muted/60 rounded animate-pulse" />
+ <div className="w-14 h-3 bg-muted/60 rounded animate-pulse" />
+ <div className="w-10 h-3 bg-muted/60 rounded animate-pulse" />
+ </div>
+ <div className="w-8 h-3 bg-muted/60 rounded animate-pulse" />
+ </div>
+ </div>
+ </div>
+ ))
+ ) : (
<div className="h-full min-h-[220px] rounded-xl border border-dashed border-border/60 bg-card/30 px-4 py-5">
<div className="space-y-2">
{[0, 1, 2].map((item) => (
diff --git a/apps/web/components/providers/query-provider.tsx b/apps/web/components/providers/query-provider.tsx
index 8b3966b..2add227 100644
--- a/apps/web/components/providers/query-provider.tsx
+++ b/apps/web/components/providers/query-provider.tsx
@@ -2,10 +2,15 @@
import { useState, type ReactNode } from "react";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
+import dynamic from "next/dynamic";
import { QUERY_CONFIG } from "@/lib/query-config";
-import { ReactQueryDevtools } from "@tanstack/react-query-devtools";
+// Dynamically import devtools only on client side to avoid SSR hydration mismatch
+const ReactQueryDevtools = dynamic(
+ () => import("@tanstack/react-query-devtools").then((mod) => mod.ReactQueryDevtools),
+ { ssr: false }
+);
interface QueryProviderProps {
children: ReactNode;