Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

perf(invoice-generator): fix high Cumulative Layout Shift (CLS) on desktop and mobile

Abierto
#159 1 comentario 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
3/5
Tiempo estimado
1-2 días
Aptitud para principiantes
66/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
nextjs, react, typescript

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug hacktoberfest help wanted

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 calls setCurrent(...).
  • Once current is 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

  1. Refactor InvoiceGeneratorClient.tsx so that initial render does not collapse into a small placeholder card.
  2. 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.
  3. Re-run Lighthouse mobile and desktop audits to verify median CLS is ≤ 0.1.
Lenguaje dominante
TypeScript
Estrellas
1
Forks
9
Merge medio
10 h 41 min
PR fusionados (30 d)
85

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de codercops/toolbelt

Todos los issues de codercops/toolbelt

Issues similares

Más issues de TypeScript

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.