Skip to content

Commit 49050c8

Browse files
Ali28202SeanCassiere
authored andcommitted
fix: showing NaN for Npm Downloads in the tanstack/config page
Handle non-finite values for npm download count.
1 parent 594754a commit 49050c8

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/components/OpenSourceStats.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ const NpmDownloadCounter = ({
5858
npmData: Parameters<typeof useNpmDownloadCounter>[0]
5959
}) => {
6060
const { count, intervalMs } = useNpmDownloadCounter(npmData)
61+
if (!Number.isFinite(count)) { // this returns true for NaN, Infinty / -Infinty, null, undefined
62+
return '-'
63+
}
6164
return <StableCounter value={count} intervalMs={intervalMs} />
6265
}
6366

0 commit comments

Comments
 (0)