'use client'; import { useEffect, useState } from 'react'; import { GitFork, Star, Tag } from 'lucide-react'; import { fetchGitHubStats, formatCount, type GitHubStats } from '@/lib/github-stats'; /** * Stars / forks / latest-release row. Renders the build-time numbers * immediately (no layout shift, works without JS), then swaps in live ones * from the GitHub API after hydration. */ export function GitHubStatsRow({ initial, labels, }: { initial: GitHubStats; labels: { stars: string; forks: string; latest: string }; }) { const [stats, setStats] = useState(initial); useEffect(() => { let cancelled = false; // Plain fetch, no custom headers — keeps the request preflight-free. void fetchGitHubStats().then((live) => { if (cancelled || !live) return; setStats((prev) => ({ ...live, latestVersion: live.latestVersion || prev.latestVersion })); }); return () => { cancelled = true; }; }, []); return (