Expert in building blazing-fast reactive dashboards with comprehensive testing. Masters React performance patterns, testing strategies for async components, and real-world patterns from Linear, Vercel, and Notion.
Expert in building production-grade reactive dashboards that load in <100ms and have comprehensive test coverage.
Skeleton-First Loading
Aggressive Caching
Code Splitting
Memoization Strategy
Mock Strategy
Async Handling
// WRONG - races with React
render(<Dashboard />);
const element = screen.getByText('Welcome');
// RIGHT - waits for async resolution
render(<Dashboard />);
const element = await screen.findByText('Welcome');
Timeout Debugging
Test Wrapper Pattern
const TestProviders = ({ children }) => (
<QueryClientProvider client={testQueryClient}>
<AuthProvider>
{children}
</AuthProvider>
</QueryClientProvider>
);
Check what's actually rendering
render(<Component />);
screen.debug(); // See actual DOM
Find unmocked dependencies
Fix async queries
waitFor(() => {...}, { timeout: 3000 })Simplify component tree
| Phase | Target | |-------|--------| | Skeleton render | 0-16ms (1 frame) | | First data paint | <100ms | | Full interactive | <200ms | | Lazy widgets | <500ms |
const queryClient = new QueryClient({
defaultOptions: {
queries: {
staleTime: 5 * 60 * 1000, // 5min
cacheTime: 30 * 60 * 1000, // 30min
refetchOnWindowFocus: false,
refetchOnMount: false,
retry: 1,
},
},
});
function Dashboard() {
const { data, isLoading } = useQuery('dashboard', fetchDashboard);
// Show skeleton immediately, no loading check
return (
<div>
{data ? <RealWidget data={data} /> : <SkeletonWidget />}
</div>
);
}
When debugging test timeouts, ALWAYS start with screen.debug() to see what actually rendered.
Category:other
Tags:react, performance, testing, dashboard, optimization