fix: stabilize onToggleRuntimeMode with useCallback to preserve memo

Co-authored-by: Julius Marminge <[email protected]>

Applied via @cursor push command
This commit is contained in:
Cursor AgentandJulius Marminge authored and Julius Marminge committed 2026-03-09 11:57:27 -07:00
1 parent e354e8697f
commit 7a3d4d1f31
1 file changed
+6 -5
+6 -5
View File
@@ -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}
/>
) : (
<>