Skip to content

FE-1856: Restore React Compiler for the Live voice control and session indicator - #9907

Open
kostandinang wants to merge 1 commit into
mainfrom
kostandin/restore-react-compiler-live-voice
Open

kostandinang wants to merge 1 commit into
mainfrom
kostandin/restore-react-compiler-live-voice

Conversation

@kostandinang

@kostandinang kostandinang commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

🌟 What is the purpose of this PR?

Let React Compiler optimize LiveConversationControl and VoiceSessionIndicator again. Each contained a construct the compiler doesn't support, so it skipped the whole component without failing the build. LiveConversationControl compiled until #9829 and #9836. VoiceSessionIndicator hadn't compiled since #9467.

🔗 Related links

🚫 Blocked by

Nothing.

🔍 What does this change?

  • LiveConversationControl:
    • The microphone check no longer uses finally, which the compiler doesn't support. Its catch handles every error, so resetting the checking state after the try behaves the same.
    • The Live bridge's mediation object moves into a createLiveMediation helper outside the component, because the compiler can't compile its history getter. The getter still reads the current conversation's history each time.
  • VoiceSessionIndicator: colorRef.current ??= targetColor becomes an if, because the compiler doesn't support logical assignment operators.

Both components now compile with no compiler diagnostics.

Pre-Merge Checklist 🚀

🚢 Has this modified a publishable library?

This PR:

  • does not modify any publishable blocks or libraries, or modifications do not need publishing

The @hashintel/petrinaut change doesn't change behaviour, so it has no changeset.

📜 Does this require a change to the docs?

The changes in this PR:

  • are internal and do not require a docs change

🕸️ Does this require a change to the Turbo Graph?

The changes in this PR:

  • do not affect the execution graph

⚠️ Known issues

  • LiveConversationControl keeps its five useCallbacks. Each is a useEffect or useLayoutEffect dependency, and the react/exhaustive-deps lint rule fails on a plain function in a dependency list even when the compiler keeps it stable.
  • Now that the compiler can analyze LiveConversationControl, react-hooks-js/set-state-in-effect warns about the setStartAwaitingStop(false) call in its voice-selection layout effect. It's a warning, not an error, and the code is unchanged.

🐾 Next steps

  • LocalStorageDemoApp already compiles, so its manual useMemo and useCallback calls can go once #9894, which rewrites much of that file, lands. Some will stay for the same exhaustive-deps reason.

🛡 What tests cover this?

  • No new tests: neither component's behaviour changes.
  • Existing: the petrinaut-website voice-interview suite (540 tests) and Petrinaut's editor component tests (24) pass.

❓ How to test this?

  1. Check out the branch and run the petrinaut-website dev server.
  2. Confirm that Vite no longer prints React Compiler warnings for live-conversation-control.tsx or voice-session-indicator.tsx.
  3. Open the AI assistant with GPT Live selected, run the microphone check, and start a Voice session. The check reports its result and the session indicator animates as before.

@kostandinang
kostandinang requested a review from a team as a code owner October 3, 2026 20:58
@vercel

vercel Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
hash Ready Ready Preview Oct 3, 2026 9:08pm UTC
petrinaut Ready Ready Preview Oct 3, 2026 9:08pm UTC
petrinaut-docs Ready Ready Preview Oct 3, 2026 9:08pm UTC
1 Skipped Deployment
Project Deployment Actions Updated
hashdotdesign-tokens Ignored Ignored Preview Oct 3, 2026 9:08pm UTC

Request Review

@cursor

cursor Bot commented Oct 3, 2026 •

Copy link
Copy Markdown

PR Summary

Low Risk
Refactors only for compiler compatibility; voice mediation, microphone check, and canvas color initialization behave the same as before.

Overview
Re-enables React Compiler on LiveConversationControl and VoiceSessionIndicator by replacing patterns the compiler cannot analyze. Runtime behavior is unchanged.

In live conversation control, the Live bridge mediation config (dynamic history getter plus prepare / summarize / offered) is built via a createLiveMediation helper defined outside the component so the getter is no longer an inline object literal inside the component. The microphone-permission check clears checkingMicrophone after the try/catch instead of in a finally block.

In voice session indicator, initializing colorRef uses an explicit if (colorRef.current === null) instead of ??=.

Reviewed by Cursor Bugbot for commit 1115dc4. Bugbot is set up for automated code reviews on this repo. Configure here.

@github-actions github-actions Bot added area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team area/apps labels Oct 3, 2026
@kostandinang kostandinang changed the title Restore React Compiler for the Live voice control and session indicator FE-1856: Restore React Compiler for the Live voice control and session indicator Oct 3, 2026
@kostandinang kostandinang self-assigned this Oct 3, 2026

This branch was successfully deployed

3 active deployments
Preview – hash — 1115dc43 Deployed Oct 3, 2026 by vercel[bot]
Preview – petrinaut — 1115dc43 Deployed Oct 3, 2026 by vercel[bot]
Preview – petrinaut-docs — 1115dc43 Deployed Oct 3, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/apps area/libs Relates to first-party libraries/crates/packages (area) type/eng > frontend Owned by the @frontend team

Development

Successfully merging this pull request may close these issues.

1 participant