Skip to content

perf: enable React Compiler for the web app#2465

Merged
aalemayhu merged 1 commit into
mainfrom
perf/react-compiler
May 19, 2026
Merged

perf: enable React Compiler for the web app#2465
aalemayhu merged 1 commit into
mainfrom
perf/react-compiler

Conversation

@aalemayhu
Copy link
Copy Markdown
Contributor

@aalemayhu aalemayhu commented May 19, 2026

Summary

  • Turns on React Compiler via babel-plugin-react-compiler in @vitejs/plugin-react's Babel chain.
  • Auto-memoizes components and hooks at build time — fewer re-renders, less main-thread work on interaction.
  • We're already on React 19.2, so the compiler runs in supported mode.

Why

Separate from the PageSpeed LCP work (render-blocking + unused JS — that's a different PR). React Compiler targets runtime/interaction perf (TBT/INP), not first paint. Low-risk to enable: if the build keeps passing and tests stay green, we keep it; if a component opts out is needed, the compiler has built-in escape hatches ('use no memo').

Test plan

  • pnpm --filter 2anki-web typecheck
  • pnpm --filter 2anki-web build (5.7s, no errors)
  • pnpm --filter 2anki-web lint (Biome clean)
  • pnpm --filter 2anki-web test --run (101 files / 774 tests pass)
  • Manual smoke: landing → upload → conversion flow stays interactive
  • Manual smoke: theme switcher, sign-in, kanban What's new

Not in this PR

  • The PageSpeed LCP fixes (defer Hotjar + GA, swap Google Fonts to non-blocking, drop bulma-switch.css, add image dimensions, lazy-load picker SDKs, cache-control on static assets). Those land separately.
  • No changelog entry — internal build-tooling change, no user-visible behavior difference.

🤖 Generated with Claude Code


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

@netlify
Copy link
Copy Markdown

netlify Bot commented May 19, 2026

Deploy Preview for notion2anki ready!

Name Link
🔨 Latest commit 34778ec
🔍 Latest deploy log https://app.netlify.com/projects/notion2anki/deploys/6a0cbefa4e70660007d73b7a
😎 Deploy Preview https://deploy-preview-2465--notion2anki.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

To edit notification comments on pull requests, go to your Netlify project configuration.

Adds babel-plugin-react-compiler to the Vite React plugin's Babel chain.
Auto-memoizes components and hooks, reducing re-renders and shaving
main-thread work on interaction-heavy pages.

Verified: pnpm typecheck, pnpm build (5.7s), pnpm lint clean, 774 tests pass.

Note: this targets INP/runtime perf, not LCP. The render-blocking +
unused-JS work from the PageSpeed report is a separate PR.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@aalemayhu aalemayhu force-pushed the perf/react-compiler branch from 13a1aa9 to 34778ec Compare May 19, 2026 19:50
@sonarqubecloud
Copy link
Copy Markdown

@aalemayhu aalemayhu marked this pull request as ready for review May 19, 2026 19:52
@aalemayhu aalemayhu merged commit 6e4bd23 into main May 19, 2026
15 checks passed
@aalemayhu aalemayhu deleted the perf/react-compiler branch May 19, 2026 19:52
aalemayhu added a commit that referenced this pull request May 20, 2026
The template gallery and editor preview both ran every starter through
a substituter that only knew about {{Field}} and {{cloze:Field}} — no
support for the {{#Field}}...{{/Field}} and {{^Field}}...{{/Field}}
section syntax Anki templates rely on, and no support for field names
with spaces.

Hits half the gallery the moment the iframe actually renders again
after the React Compiler revert: Image Occlusion (uses {{#Header}} and
{{#Back Extra}}), every Notion variant on the cloze base type (uses
{{#Extra}}), the Abhiyan Night Mode pair (uses {{#Tags}}), and the
Modern Cloze / Vocabulary / Medical / etc. starters in
DefaultTemplatesService (use {{#Example}}, {{#Mnemonic}}). Thumbnails
either rendered the literal {{#Field}} / {{/Field}} tokens or went
blank when an entire layout sat inside a section block.

Pre-existing since the note-types page shipped on 2026-05-15, masked
until now by the iframe-srcDoc freeze from #2465.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant