Skip to content

Commit 9bbb600

Browse files
committed
fix: stabilize onToggleRuntimeMode with useCallback to preserve memo
Co-authored-by: Julius Marminge <[email protected]> Applied via @cursor push command
1 parent 5d6a99a commit 9bbb600

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

apps/web/src/components/ChatView.tsx

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1675,6 +1675,11 @@ export default function ChatView({ threadId }: ChatViewProps) {
16751675
const toggleInteractionMode = useCallback(() => {
16761676
handleInteractionModeChange(interactionMode === "plan" ? "default" : "plan");
16771677
}, [handleInteractionModeChange, interactionMode]);
1678+
const toggleRuntimeMode = useCallback(() => {
1679+
void handleRuntimeModeChange(
1680+
runtimeMode === "full-access" ? "approval-required" : "full-access",
1681+
);
1682+
}, [handleRuntimeModeChange, runtimeMode]);
16781683
const togglePlanSidebar = useCallback(() => {
16791684
setPlanSidebarOpen((open) => {
16801685
if (open) {
@@ -3745,11 +3750,7 @@ export default function ChatView({ threadId }: ChatViewProps) {
37453750
onCodexFastModeChange={onCodexFastModeChange}
37463751
onToggleInteractionMode={toggleInteractionMode}
37473752
onTogglePlanSidebar={togglePlanSidebar}
3748-
onToggleRuntimeMode={() =>
3749-
void handleRuntimeModeChange(
3750-
runtimeMode === "full-access" ? "approval-required" : "full-access",
3751-
)
3752-
}
3753+
onToggleRuntimeMode={toggleRuntimeMode}
37533754
/>
37543755
) : (
37553756
<>

0 commit comments

Comments
 (0)