Skip to content

perf: enable React Compiler (completes deferred Task 141 rerender audit) #699

Description

@d-oit

Summary

Task 141 (rerender audit & React 19 optimization) was deferred with the rationale that "React 19 compiler handles most automatic optimizations" — but the React Compiler is not enabled in this repo.

Analysis (2026-08-17)

  • Stack: React 19.0 + Next.js 16.2.12. Next.js 16 promotes reactCompiler from experimental to stable (not enabled by default).
  • No reactCompiler config in next.config.ts today.
  • The codebase is already compiler-friendly:
    • Zustand selector subscriptions (useStudioStore((s) => s.entities)) throughout
    • useMemo/useCallback already applied in hot views (graph-view, mindmap-view, chat-view, library-entities)
    • No any in src/, no empty catch {} blocks, no LOC > 500 violations, no TODO/FIXME debt
    • Plan 122 already added a scoped react-hooks/incompatible-library suppression for the virtualizer hook — evidence the compiler was anticipated

Plan

  1. pnpm add -D babel-plugin-react-compiler
  2. Set reactCompiler: true in next.config.ts
  3. Run full quality gate: lint, typecheck, unit tests, build, E2E
  4. Reconcile Task 141 plan status + add a plan/ doc following repo convention

Acceptance Criteria

  • pnpm run build passes (Next.js 16 + Turbopack)
  • All unit tests pass
  • E2E suite passes (no behavioral regressions from auto-memoization)
  • No new lint/typecheck warnings
  • Task 141 marked complete with verification notes

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions