Skip to content

Commit 6dbaad2

Browse files
committed
fix: respect formatter when value is 0 on state comp
1 parent cf721a1 commit 6dbaad2

File tree

2 files changed

+15
-13
lines changed

2 files changed

+15
-13
lines changed

apps/dashboard/src/@3rdweb-sdk/react/hooks/useApi.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ import {
55
useQueryClient,
66
} from "@tanstack/react-query";
77
import { THIRDWEB_ANALYTICS_API_HOST, THIRDWEB_API_HOST } from "constants/urls";
8+
import { useAllChainsData } from "hooks/chains/allChains";
89
import invariant from "tiny-invariant";
910
import { accountKeys, apiKeys, authorizedWallets } from "../cache-keys";
1011
import { useLoggedInUser } from "./useLoggedInUser";
11-
import { useAllChainsData } from "hooks/chains/allChains";
1212

1313
// FIXME: We keep repeating types, API server should provide them
1414

@@ -268,17 +268,17 @@ export interface BillingCredit {
268268

269269
interface UseAccountInput {
270270
refetchInterval?:
271-
| number
272-
| false
273-
| ((
274-
query: Query<
275-
Account,
276-
Error,
277-
Account,
278-
readonly ["account", string, "me"]
279-
>,
280-
) => number | false | undefined)
281-
| undefined;
271+
| number
272+
| false
273+
| ((
274+
query: Query<
275+
Account,
276+
Error,
277+
Account,
278+
readonly ["account", string, "me"]
279+
>,
280+
) => number | false | undefined)
281+
| undefined;
282282
}
283283

284284
export function useAccount({ refetchInterval }: UseAccountInput = {}) {

apps/dashboard/src/components/analytics/stat.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ export const Stat: React.FC<{
88
<dl className="flex items-center justify-between gap-4 rounded-lg border border-border bg-muted/50 p-4 lg:p-6">
99
<div>
1010
<dd className="font-semibold text-3xl tracking-tight lg:text-5xl">
11-
{value && formatter ? formatter(value) : value?.toLocaleString()}
11+
{value !== undefined && formatter
12+
? formatter(value)
13+
: value?.toLocaleString()}
1214
</dd>
1315
<dt className="font-medium text-muted-foreground text-sm tracking-tight lg:text-lg">
1416
{label}

0 commit comments

Comments
 (0)