Skip to content

Open-source Grok Bot alternative for named AI teammates. Local-first desktop, web, and mobile clients with per-bot tools, instructions, and memory. Independent fork of T3 Code.

fix: stabilize onToggleRuntimeMode with useCallback to preserve memo

Cursor Agent7a3d4d1f31e4
diff --git a/apps/web/src/components/ChatView.tsx b/apps/web/src/components/ChatView.tsx
index 565ce201f..5fb47b1a9 100644
--- a/apps/web/src/components/ChatView.tsx
+++ b/apps/web/src/components/ChatView.tsx
@@ -1675,6 +1675,11 @@ export default function ChatView({ threadId }: ChatViewProps) {
const toggleInteractionMode = useCallback(() => {
handleInteractionModeChange(interactionMode === "plan" ? "default" : "plan");
}, [handleInteractionModeChange, interactionMode]);
+ const toggleRuntimeMode = useCallback(() => {
+ void handleRuntimeModeChange(
+ runtimeMode === "full-access" ? "approval-required" : "full-access",
+ );
+ }, [handleRuntimeModeChange, runtimeMode]);
const togglePlanSidebar = useCallback(() => {
setPlanSidebarOpen((open) => {
if (open) {
@@ -3745,11 +3750,7 @@ export default function ChatView({ threadId }: ChatViewProps) {
onCodexFastModeChange={onCodexFastModeChange}
onToggleInteractionMode={toggleInteractionMode}
onTogglePlanSidebar={togglePlanSidebar}
- onToggleRuntimeMode={() =>
- void handleRuntimeModeChange(
- runtimeMode === "full-access" ? "approval-required" : "full-access",
- )
- }
+ onToggleRuntimeMode={toggleRuntimeMode}
/>
) : (
<>