Skip to content

revert: disable React Compiler — breaks iframe srcDoc updates#2479

Merged
aalemayhu merged 1 commit into
mainfrom
fix/revert-react-compiler
May 20, 2026
Merged

revert: disable React Compiler — breaks iframe srcDoc updates#2479
aalemayhu merged 1 commit into
mainfrom
fix/revert-react-compiler

Conversation

@aalemayhu
Copy link
Copy Markdown
Contributor

@aalemayhu aalemayhu commented May 20, 2026

Summary

Reverts #2465. The React Compiler auto-memoization is freezing every component that drives an <iframe srcDoc={...}> off React state: it treats the iframe element as structurally identical across renders and skips the srcDoc attribute patch. The preview stays on the first render forever.

Production impact

Confirmed broken right now:

  • /templates editor previewweb/src/pages/TemplatesPage/EditorPage.tsx. Editing HTML, CSS, or field values does not update the live preview iframe.
  • Apkg deck previewweb/src/pages/PreviewApkgPage/CardFrame.tsx. The flip button does not reveal the back of the card.
  • Shared deck recipient pageweb/src/pages/SharedDeckPage (uses CardFrame). Same root cause; anonymous share recipients hit it too.

Why revert and not opt out

A surgical 'use no memo' directive at the top of those two files would also fix the known surfaces. But:

  1. There is no existing protection against the same pattern showing up elsewhere — no 'use no memo' anywhere in the codebase before this PR.
  2. We can't enumerate every iframe-srcDoc consumer in the time it takes to ship the hotfix.
  3. The reverted change is self-contained (build-time only): web/vite.config.ts, web/package.json, pnpm-lock.yaml — no source code depends on the compiler being on.

Reintroduce the compiler later behind explicit iframe regression tests that catch this class of failure.

Test plan

  • pnpm --filter 2anki-web typecheck clean
  • pnpm --filter 2anki-web test green
  • pnpm --filter 2anki-web build clean
  • After deploy: open https://2anki.net/templates, edit HTML in the editor, confirm the preview iframe reflects the change
  • After deploy: open an apkg preview, click Show back, confirm the back of the card renders

🤖 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

Reverts 6e4bd23. The auto-memoization is patching too aggressively
on components that drive an <iframe srcDoc={...}> off React state: it
decides the iframe element is structurally identical across renders and
skips the srcDoc attribute update, leaving the preview frozen on the
initial render.

Hit in two places in production:
- web/src/pages/TemplatesPage/EditorPage.tsx — /templates editor preview
  doesn't update when the user edits HTML/CSS or field values.
- web/src/pages/PreviewApkgPage/CardFrame.tsx — apkg deck preview flip
  button doesn't reveal the back of the card.

Same pattern exists on the new web/src/pages/SharedDeckPage via
CardFrame, so anonymous share recipients hit it too.

A surgical `'use no memo'` opt-out on the two files would also fix this,
but there's no protection against the same pattern showing up elsewhere
and we have no way to find every iframe srcDoc consumer in 30 seconds.
Revert the whole enable; reintroduce later behind explicit iframe tests
that catch this class of regression.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@netlify
Copy link
Copy Markdown

netlify Bot commented May 20, 2026

Deploy Preview for notion2anki ready!

Name Link
🔨 Latest commit cc35d29
🔍 Latest deploy log https://app.netlify.com/projects/notion2anki/deploys/6a0daf3225f0860008501662
😎 Deploy Preview https://deploy-preview-2479--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.

@aalemayhu aalemayhu merged commit 728c454 into main May 20, 2026
13 checks passed
@aalemayhu aalemayhu deleted the fix/revert-react-compiler branch May 20, 2026 12:55
@sonarqubecloud
Copy link
Copy Markdown

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