mirror of
https://github.com/coder/coder.git
synced 2026-11-09 15:42:57 +08:00
The hook lived at src/hooks/, outside the React Compiler scope. It returned a new object literal every render, causing three handler guards and two downstream JSX guards in AgentChatInput (233 cache slots) to always miss. Move the hook to src/pages/AgentsPage/hooks/ where the compiler processes it. The compiler auto-memoizes the return object, so manual useMemo is unnecessary. Also replace ctorRef.current render-time access with a useState lazy initializer. The ref access caused a CompileError that would have prevented compilation. Browser API availability is constant, so useState captures it once.