diff --git a/app/modules/stats/index.tsx b/app/modules/stats/index.tsx index aa45ce38..3159029e 100644 --- a/app/modules/stats/index.tsx +++ b/app/modules/stats/index.tsx @@ -43,34 +43,32 @@ global.statCountsCache ??= new LRUCache({ }, }); -export async function getStats(): Promise { +export async function getStats(): Promise { let cacheKey = "ONE_STATS_KEY_TO_RULE_THEM_ALL"; let statCounts = await statCountsCache.fetch(cacheKey); - return statCounts - ? [ - { - count: statCounts.npmDownloads, - label: "Downloads on npm", - svgId: "stat-download", - }, - { - count: statCounts.githubContributors, - label: "Contributors on GitHub", - svgId: "stat-users", - }, - { - count: statCounts.githubStars, - label: "Stars on GitHub", - svgId: "stat-star", - }, - { - count: statCounts.githubDependents, - label: "Dependents on GitHub", - svgId: "stat-box", - }, - ] - : undefined; + return [ + { + count: statCounts.npmDownloads, + label: "Downloads on npm", + svgId: "stat-download", + }, + { + count: statCounts.githubContributors, + label: "Contributors on GitHub", + svgId: "stat-users", + }, + { + count: statCounts.githubStars, + label: "Stars on GitHub", + svgId: "stat-star", + }, + { + count: statCounts.githubDependents, + label: "Dependents on GitHub", + svgId: "stat-box", + }, + ]; } /** diff --git a/app/pages/splash.tsx b/app/pages/splash.tsx index 84d8b7db..56647621 100644 --- a/app/pages/splash.tsx +++ b/app/pages/splash.tsx @@ -7,11 +7,7 @@ import { getStats } from "~/modules/stats"; import { getRootMatchData } from "~/ui/meta"; export let loader = async () => { - const stats = await getStats(); - // replace with something better, just fixing types - if (!stats) { - throw new Error("Failed to load stats"); - } + const stats = getStats(); return { stats }; }; @@ -153,7 +149,6 @@ export default function Home() { {(stats) => (
    - {/* @ts-expect-error -- these types didn't make it into RR7, this needs to be fixed */} {stats.map(({ svgId, count, label }) => (