perf(invoice-generator): fix high Cumulative Layout Shift (CLS) on desktop and mobile
I maintainer di solito rispondono entro 1 giorno
Valutazione
- Difficoltà
- 3/5
- Tempo stimato
- 1-2 giorni
- Idoneità per principianti
- 66/100
- Tipo di issue
- Bug
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Attiva
- Stack tecnologico
- nextjs, react, typescript
- Ambito
- frontend, performance
Direzione di ricerca
Start in app/(tools)/invoice-generator/InvoiceGeneratorClient.tsx, where the current state begins as null and the Loading… placeholder section renders until the useEffect reads localStorage. Reproduce the shift with a Lighthouse run on the production URL to confirm the FAQ and CTA sections move. Done when the median CLS is at or below 0.1 on both desktop and mobile, with the skeleton matching the toolbar, editor and preview dimensions.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Problem
During the baseline performance audit (#28), the Invoice Generator page was found to have severe Cumulative Layout Shift (CLS), failing the Core Web Vitals threshold of CLS ≤ 0.1 on both desktop and mobile.
Affected Production URL
https://tools.codercops.com/invoice-generator
Device
Desktop and Mobile
Measured Evidence
Lighthouse performance audit results (median of 3 runs on 2026-10-14, failing threshold is CLS > 0.1):
- Desktop Median CLS: 0.554 (individual runs: 0.555, 0.554, 0.554) — FAIL
- Mobile Median CLS: 0.465 (individual runs: 0.465, 0.465, 0.465) — FAIL
Root Cause / Culprit
Lighthouse identifies body.antialiased > main#main-content > section.mx-auto (the FAQ and CTA sections) as shifting by over 1,000px.
In app/(tools)/invoice-generator/InvoiceGeneratorClient.tsx:
- The client component initializes
const [current, setCurrent] = useState<Invoice | null>(null);. - During SSR and initial client render when
current === null, it renders a small placeholder card:<section className="mx-auto max-w-7xl w-full px-4 sm:px-6 pb-8"> <div className="card p-10 text-center text-[var(--fg-muted)] text-[13px]">Loading…</div> </section> - In
useEffect, it reads localStorage and callssetCurrent(...). - Once
currentis populated, the full toolbar, two-column editor form, and live preview are inserted into the DOM, pushing the FAQ and CTA sections down and triggering a large layout shift score (0.554 desktop, 0.465 mobile).
Concrete Next Step
- Refactor
InvoiceGeneratorClient.tsxso that initial render does not collapse into a small placeholder card. - Initialize default invoice state or render a layout-preserving skeleton that matches the dimensions of the toolbar, editor, and preview grids during SSR and before hydration.
- Re-run Lighthouse mobile and desktop audits to verify median CLS is ≤ 0.1.
- Lingua principale
- TypeScript
- Stelle
- 1
- Fork
- 9
- Merge medio
- 10h 24m
- PR unite (30g)
- 93
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 codercops/toolbelt
-
bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 90/100
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 94/100
I maintainer di solito rispondono entro 1 giorno
-
bug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 92/100
I maintainer di solito rispondono entro 1 giorno
-
Stop the JSON formatter's Find bar from typing into the JSONForse già presa @kudala-bharani l’ha presa 2 giorni fa. Apertabug hacktoberfest help wanted
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
codercops/toolbelt#121 · 2 commenti · 1 assegnatario ·
I maintainer di solito rispondono entro 1 giorno
-
JSON formatter: a duplicate key crashes the whole toolForse già presa @lb1192176991-lab l’ha presa 1 giorno fa. Apertabug good first issue hacktoberfest
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
codercops/toolbelt#218 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di codercops/toolbelt
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
paperclipai/paperclip#17151 ·
I maintainer di solito rispondono entro 1 giorno
-
needs-triage
Difficoltà 2/5 1-3 ore Idoneità per principianti 83/100
AgoraIO-Extensions/agent-infra#3159 ·
I maintainer di solito rispondono entro 1 giorno
-
blocklist addition
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 66/100
MetaMask/eth-phishing-detect#304596 ·
I maintainer di solito rispondono entro 1 giorno
-
friction
Difficoltà 2/5 1-3 ore Idoneità per principianti 70/100
kentcdodds/kody#4142 ·
-
[Bug] Statistics | Task statistics are always empty on MikroORM with MySQL or SQLiteForse già presa @NdekoCode l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 76/100
ever-co/ever-gauzy#11214 ·
I maintainer di solito rispondono entro 1 giorno