Summary
This project uses React 19.2.1 which includes support for the React Compiler.
Enabling it would allow us to remove manual memoization hooks (useCallback, useMemo) throughout the codebase, as the compiler handles this automatically.
Current State
Components like conversation-bar.tsx have multiple manual useCallback hooks to prevent unnecessary re-renders:
const getMicStream = React.useCallback(async () => { ... }, [])
const startConversation = React.useCallback(async () => { ... }, [conversation, getMicStream, agentId, onError])
const handleEndSession = React.useCallback(() => { ... }, [conversation])
const toggleMute = React.useCallback(() => { ... }, [])
const handleStartOrEnd = React.useCallback(() => { ... }, [agentState, handleEndSession, startConversation])
const handleSendText = React.useCallback(() => { ... }, [conversation, textInput, onSendMessage])
const handleTextChange = React.useCallback(() => { ... }, [conversation, isConnected])
const handleKeyDown = React.useCallback(() => { ... }, [handleSendText])
Proposed Change
Enable the React Compiler in next.config.mjs:
const nextConfig = {
reactCompiler: true,
// ...existing config
}
References
Summary
This project uses React 19.2.1 which includes support for the React Compiler.
Enabling it would allow us to remove manual memoization hooks (useCallback, useMemo) throughout the codebase, as the compiler handles this automatically.
Current State
Components like
conversation-bar.tsxhave multiple manual useCallback hooks to prevent unnecessary re-renders:Proposed Change
Enable the React Compiler in next.config.mjs:
References