UI Performance & Virtualization Skill
Purpose
Guide efficient rendering, virtualization, code splitting, and non-crashing UI state boundaries.
1. Principles & Rules
CONDITIONAL VIRTUALIZATION
- Virtualize list views (e.g.
react-windowFixedSizeList) when dataset size, row complexity, DOM weight, interaction cost, or rendering frequency makes standard rendering materially expensive. - Prefer server pagination for large datasets when the user experience does not require a continuous infinite scroll list.
CODE SPLITTING VS ERROR HANDLING
Explicitly distinguish between bundle splitting and runtime error isolation:
React.lazy: Deferred component bundle loading.Suspense: UI loading indicator fallback while lazy bundle resolves.ErrorBoundary: Catches unhandled runtime JavaScript errors to prevent full page crashes.
<ErrorBoundary fallback={<Alert severity="error">Failed to load view</Alert>}>
<Suspense fallback={<TableSkeleton />}>
<LazyTransactionTable data={data} />
</Suspense>
</ErrorBoundary>