Skip to content

fix: restore react compiler and stop history modal render loop - #128

Merged
unvalley merged 1 commit into
mainfrom
fix/react-compiler-history-modal
Oct 25, 2026
Merged

unvalley merged 1 commit into
mainfrom
fix/react-compiler-history-modal

Conversation

@unvalley

Copy link
Copy Markdown
Owner

Since the Vite 8 upgrade (f0a07ed), React Compiler has not run: @vitejs/plugin-react v6 dropped the babel option, so the config was silently ignored. Without memoization, the history modal's open effect depended on a refresh recreated every render and looped until React hit "Maximum update depth exceeded", leaving "Loading tasks…" on screen.

  • Run the compiler through @rolldown/plugin-babel with reactCompilerPreset(); add @rolldown/plugin-babel, @babel/core, @types/babel__core
  • Pin @babel/core to v7: under Babel 8, babel-plugin-react-compiler 1.0.0 skips any component with destructured prop defaults (e.g. HistoryModal)
  • Reload history data inside useHistoryData(isOpen), keyed on isOpen only; drop refresh from the hook and the modal

Validation: tsc, pnpm lint, vitest run src (157 passed), vite build. In the dev server with 61 completed tasks, the Tasks tab renders in ~16 ms with no console errors (before: stuck on "Loading tasks…" with 377 update-depth errors), and a task added while the modal is closed shows on reopen. Served history-modal.tsx, use-history-data.ts, and the menu modules include the compiler runtime.

Still skipped by the compiler, unchanged here: editor-page.tsx (ref read during render), codemirror-editor.tsx and multi-editor.tsx (getter in an object literal), use-document-picture-in-picture.ts (try…finally).

@vitejs/plugin-react v6 dropped the `babel` option, so the React Compiler
config in vite.config.ts was silently ignored after the Vite 8 upgrade.
Without memoization, the history modal's open effect depended on a
`refresh` function recreated every render and looped until React hit its
update depth limit, leaving "Loading tasks…" on screen.

- Run the compiler through @rolldown/plugin-babel with reactCompilerPreset.
  Pin @babel/core to v7: under Babel 8, babel-plugin-react-compiler 1.0.0
  skips components with destructured prop defaults.
- Reload history data inside useHistoryData, keyed on isOpen only, so the
  modal no longer depends on refresh's identity.
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying ephe with  Cloudflare Pages  Cloudflare Pages

Latest commit: bbb5b9f
Status: ✅  Deploy successful!
Preview URL: https://ea3a36e0.ephe.pages.dev
Branch Preview URL: https://fix-react-compiler-history-m.ephe.pages.dev

View logs

@unvalley
unvalley merged commit 8b33dda into main Oct 25, 2026
4 checks passed
@unvalley
unvalley deleted the fix/react-compiler-history-modal branch October 25, 2026 03:12
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