Homepage fails to compile: the hero's contributor count references an undefined `platformStats`, and would show the mock value even once it resolves
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- next.js, typescript
- Ambito
- frontend
Direzione di ricerca
Inizia da src/app/page.tsx, in particolare dalla risoluzione di stats alle righe 93–116 e dalla riga dei contributor nell’hero alla riga 153. Controlla come l’hero e le schede delle statistiche usano il valore risolto, poi esegui npx tsc --noEmit per confermare che il nome non definito è stato corretto. Il lavoro è completato quando la homepage viene compilata e l’hero usa le statistiche risolte; verifica il campo contributor di /analytics/platform prima di presentare quel numero come reale.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Location
src/app/page.tsx:153 (import at line 23, live value at lines 93-116)
Problem
The hero's social-proof line reads:
{formatInteger(platformStats.activeContributors)} contributors
There is no binding named platformStats in this module. Line 23 deliberately renames the import:
import {
platformStats as mockPlatformStats,
...
} from "@/lib/mock-data";
platformStats is not declared locally, not a global, and not imported under that name anywhere in the file — grep -n platformStats src/app/page.tsx returns exactly two hits: the aliased import on line 23 and this usage on line 153. The result is TS2304: Cannot find name 'platformStats', so tsc --noEmit and next build both fail, and at runtime the expression would throw a ReferenceError while rendering the homepage.
There is a second defect hiding behind the first. The component resolves a live figure into a local stats (lines 93-116: it fetches /analytics/platform with next: { revalidate: 60 } and falls back to mockPlatformStats), and every StatCard below reads from stats. Only this one line bypasses it. So the minimal "fix the name" change — rewriting it to mockPlatformStats.activeContributors — would compile but permanently print the bundled mock contributor count in the hero while the stat grid twenty lines down prints the real one, which is the exact failure closed issue #237 was about ("HomePage's hero copy hardcodes '341 contributors' as literal text instead of referencing platformStats").
Note also that DataSourceNotice (line 189) only covers the stat grid, so a mock-sourced hero number would carry no provenance badge at all.
Why it matters
/ is the application's entry point and the highest-priority URL in the sitemap (src/lib/sitemap.ts:46 gives it priority: 1). A TS2304 here means the whole build is red, so nothing ships. If it is patched to the mock constant instead of the live one, the landing page tells every visitor a fabricated number of contributors — a trust-relevant claim on a product that moves real money — and contradicts the live "Active contributors" card rendered on the same screen.
Reproduction
npm cinpx tsc --noEmit→src/app/page.tsx(153,30): error TS2304: Cannot find name 'platformStats'.npm run buildfails with the same error. Undernpm run dev, loading/renders the Next.js error overlay instead of the homepage.
Suggested fix
Change line 153 to read from the resolved local, so the hero and the stat grid can never disagree:
{formatInteger(stats.activeContributors)} contributors
Two follow-ups worth doing in the same change:
- The live mapping at lines 106-111 assigns
activeContributors: raw.totalRepos. A repository count is not a contributor count; either the backend field name is wrong or the mapping is. Confirm against the/analytics/platformresponse before relying on this number in hero copy. - Move the
statsSource === "mock"provenance notice (line 189) above the hero's social-proof line, or add aSampleDataChipbeside it, so a fallback hero number is visibly marked as sample data.
Adding tsc --noEmit to CI would prevent an undefined identifier in a route file from reaching the default branch.
- Lingua principale
- TypeScript
- Stelle
- 1
- Fork
- 94
- Merge medio
- 1h 2m
- PR unite (30g)
- 25
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di MergeFi/frontend
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
bug testing
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 84/100
I maintainer di solito rispondono entro 1 giorno
-
accessibility bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
MergeFi/frontend#835 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di MergeFi/frontend
Issue simili
-
ログイン中の404画面にヘッダーとナビを出すApertaCodex使用可 コード
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
ryuki-moro/Nicomaru#218 ·
I maintainer di solito rispondono entro 3 giorni
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
sveltejs/svelte-eslint-parser#1008 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
silverbucket/inbox-rs#351 ·
I maintainer di solito rispondono entro 1 giorno
-
[Bug]: The H2 series' and the H3C's fan 3 is labelled "Chamber Fan", Bambu calls it the exhaust fanApertaarea:ui
Difficoltà 2/5 1-3 ore Idoneità per principianti 88/100
I maintainer di solito rispondono entro 1 giorno
-
bug front P2
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
invoicerr-app/invoicerr#964 ·
I maintainer di solito rispondono entro 1 giorno