The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.
TypeScript clickhousemysqlnextjsopen-sourceplanetscaleprismatailwindcsstinybirdtypescriptupstashvercel
Handle stats error
shuwentey58b9503a9516
diff --git a/app/dub.co/page.tsx b/app/dub.co/page.tsxindex 8b26115d60..be2fbd869e 100644--- a/app/dub.co/page.tsx+++ b/app/dub.co/page.tsx@@ -22,7 +22,7 @@ export default function Home() {</Suspense><Suspensefallback={- <StatsSection domains={1000} shortlinks={20000} clicks={3500000} />+ <StatsSection domains={1000} shortlinks={20000} clicks={5000000} />}><Stats />diff --git a/app/ui/home/stats.tsx b/app/ui/home/stats.tsxindex b8904f6811..20e12cc022 100644--- a/app/ui/home/stats.tsx+++ b/app/ui/home/stats.tsx@@ -4,25 +4,25 @@ import { nFormatter } from "#/lib/utils";export default async function Stats() {const [domains, shortlinks, clicks] = await Promise.all([- prisma.domain.count({- where: {- verified: true,+ prisma.domain+ .count({+ where: {+ verified: true,+ },+ })+ .catch(() => 1000),+ prisma.link.count().catch(() => 20000),+ fetch(`https://api.us-east.tinybird.co/v0/pipes/all_clicks.json`, {+ headers: {+ Authorization: `Bearer ${process.env.TINYBIRD_API_KEY}`,},- }),- prisma.link.count(),- process.env.TINYBIRD_API_KEY- ? fetch(`https://api.us-east.tinybird.co/v0/pipes/all_clicks.json`, {- headers: {- Authorization: `Bearer ${process.env.TINYBIRD_API_KEY}`,- },- next: {- revalidate: 300,- },- })- .then((res) => res.json())- .then((res) => res.data[0]["count(timestamp)"])- .catch(() => 5000000)- : 5000000,+ next: {+ revalidate: 300,+ },+ })+ .then((res) => res.json())+ .then((res) => res.data[0]["count(timestamp)"])+ .catch(() => 5000000),]);return (