fix(frontend): switch React Compiler to opt-in annotation mode#2375
fix(frontend): switch React Compiler to opt-in annotation mode#2375malinskibeniamin wants to merge 2 commits intomasterfrom
Conversation
The compiler was running in default "infer" (opt-out) mode, memoizing every component/hook globally. This caused stale closures and missed re-renders in pagination, data table filters, and search components — 58 files already needed 'use no memo' workarounds. Switch to compilationMode: 'annotation' so the compiler only processes files explicitly marked with 'use memo'. Remove all 71 'use no memo' directives (now dead code). No files are opted in yet — this is a stabilization change. Files can be incrementally opted in after testing. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
@claude review |
|
Claude finished @malinskibeniamin's task in 1m 21s —— View job Code Review
Overall: Clean, well-justified stabilization change. The approach is correct — 58 files needing
|
- Add comment above sources callback explaining it gates opt-in eligibility even in annotation mode - Add panicThreshold: 'critical_errors' so the build fails loudly if the compiler can't handle an explicitly opted-in file Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
|
Thanks for the review! Addressed all feedback in 621df6f:
|
|
@claude review |
|
Claude finished @malinskibeniamin's task in 53s —— View job Code Review
All previous feedback has been correctly addressed. Here's the verification:
|
Summary
"infer") to opt-in (compilationMode: 'annotation') inrsbuild.config.ts'use no memo'directives across 58 files (now dead code — compiler only processes files with'use memo')data-table-view-options.test.tsxto reflect the new approachProblem
The React Compiler was running in default "infer" (opt-out) mode, automatically memoizing every component and hook in
src/. This caused:data-table-filter.tsxand related components broke under compiler memoization'use no memo'workarounds to function correctlyuiSettingsProxy pattern, URL-based state (nuqs), and TanStack Table's internal state managementSolution
Switch to
compilationMode: 'annotation'— the compiler now only processes files explicitly marked with'use memo'. No files are opted in yet. This is a stabilization change that eliminates all compiler-related memoization bugs while keeping the infrastructure in place for incremental opt-in.What changes:
'use no memo'directivesFuture work:
'use memo'to safe presentational components after testinguiSettingsProxy pattern before opting in components that use itpanicThreshold: 'critical_errors'once confidence growsTest plan
bun run type:check— passesbun run lint— passes (pre-existing warnings only)bun run test— 80 files, 856 tests passed, 0 failures'use no memo'directives remain (grep -r "use no memo" src/returns only the updated test comment)🤖 Generated with Claude Code