Performance: Global-error.tsx for root errors
MEDIUM IMPACT
This affects the page's error handling responsiveness and visual stability during root-level errors.
export default function GlobalError({ error }) { return ( <main role="alert" aria-live="assertive" style={{ display: 'flex', alignItems: 'center', justifyContent: 'center', minHeight: '100vh' }}> <section> <h1>Something went wrong</h1> <p>{error.message}</p> </section> </main> ); }
export default function GlobalError({ error }) { return <div style={{ minHeight: '100vh' }}>{error.message}</div>; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Inline styled error div with dynamic height | Low (few nodes) | Multiple reflows due to dynamic height | Medium paint cost | [X] Bad |
| Semantic main and section with fixed flex layout | Low (few nodes) | Single reflow with fixed layout | Low paint cost | [OK] Good |