Skip to content

armgit / dub

Public Imported from GitHub
0

The modern link attribution platform. Loved by world-class engineering teams at Twilio, Zillow, Jobber, Vercel, Raycast, and more.

fix undefined

Steven Teye4df8172693d
diff --git a/apps/web/app/admin.dub.co/(dashboard)/commissions/client.tsx b/apps/web/app/admin.dub.co/(dashboard)/commissions/client.tsx
index 48ccd48dc8..bb12ed88d6 100644
--- a/apps/web/app/admin.dub.co/(dashboard)/commissions/client.tsx
+++ b/apps/web/app/admin.dub.co/(dashboard)/commissions/client.tsx
@@ -86,13 +86,10 @@ export default function CommissionsPageClient() {
const totals = useMemo(() => {
return {
commissions: timeseries?.reduce(
- (acc, { commissions }) => acc + (commissions || 0),
- 0,
- ),
- revenue: timeseries?.reduce(
- (acc, { revenue }) => acc + (revenue || 0),
+ (acc, { commissions }) => acc + commissions,
0,
),
+ revenue: timeseries?.reduce((acc, { revenue }) => acc + revenue, 0),
};
}, [timeseries]);
@@ -205,7 +202,9 @@ export default function CommissionsPageClient() {
<span>{label}</span>
</div>
<div className="mt-1 flex h-12 items-center">
- {totals[id] ? (
+ {totals[id] === undefined ? (
+ <div className="h-10 w-24 animate-pulse rounded-md bg-neutral-200" />
+ ) : (
<NumberFlow
value={totals[id] / 100}
className="text-xl font-medium sm:text-3xl"
@@ -216,8 +215,6 @@ export default function CommissionsPageClient() {
trailingZeroDisplay: "stripIfInteger",
}}
/>
- ) : (
- <div className="h-10 w-24 animate-pulse rounded-md bg-neutral-200" />
)}
</div>
</button>
diff --git a/apps/web/app/admin.dub.co/(dashboard)/payouts/client.tsx b/apps/web/app/admin.dub.co/(dashboard)/payouts/client.tsx
index 1be1184030..c44523f2a2 100644
--- a/apps/web/app/admin.dub.co/(dashboard)/payouts/client.tsx
+++ b/apps/web/app/admin.dub.co/(dashboard)/payouts/client.tsx
@@ -225,7 +225,9 @@ export default function PayoutsPageClient() {
<span>{label}</span>
</div>
<div className="mt-1 flex h-12 items-center">
- {totals[id] || totals[id] === 0 ? (
+ {totals[id] === undefined ? (
+ <div className="h-10 w-24 animate-pulse rounded-md bg-neutral-200" />
+ ) : (
<NumberFlow
value={totals[id] / 100}
className="text-xl font-medium sm:text-3xl"
@@ -236,8 +238,6 @@ export default function PayoutsPageClient() {
trailingZeroDisplay: "stripIfInteger",
}}
/>
- ) : (
- <div className="h-10 w-24 animate-pulse rounded-md bg-neutral-200" />
)}
</div>
</button>