@devries-cameron20 / t3code Mirror · read-only / commits / 1a5ff424ce
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 24, 16:30 UTC

fix(web): keep multi-select questions open after the first click (#6646)

RaitP1 committed Aug 15, 2026 at 15:25 UTC 1a5ff424cee104e1e8bbcf9bbf5414bbad843be3
1 file changed +19 -16
apps/web/src/components/chat/ComposerPendingUserInputPanel.tsx
+19 -16
@@ -1,5 +1,5 @@
1 import { type ApprovalRequestId } from "@t3tools/contracts";
2 -import { memo, useEffect, useEffectEvent, useRef, useState } from "react";
2 +import { memo, useCallback, useEffect, useRef, useState } from "react";
3 import { type PendingUserInput } from "../../session-logic";
4 import {
5 derivePendingUserInputProgress,
@@ -109,21 +109,24 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
109 };
110 }, []);
111
112 - const handleOptionSelection = useEffectEvent((questionId: string, optionLabel: string) => {
113 - if (activeQuestion?.multiSelect) {
112 + const handleOptionSelection = useCallback(
113 + (questionId: string, optionLabel: string) => {
114 + if (activeQuestion?.multiSelect) {
115 + onToggleOption(questionId, optionLabel);
116 + return;
117 + }
118 + setOptimisticSingleSelect({ questionId, optionLabel });
119 onToggleOption(questionId, optionLabel);
115 - return;
116 - }
117 - setOptimisticSingleSelect({ questionId, optionLabel });
118 - onToggleOption(questionId, optionLabel);
119 - if (autoAdvanceTimerRef.current !== null) {
120 - window.clearTimeout(autoAdvanceTimerRef.current);
121 - }
122 - autoAdvanceTimerRef.current = window.setTimeout(() => {
123 - autoAdvanceTimerRef.current = null;
124 - onAdvanceRef.current();
125 - }, 200);
126 - });
120 + if (autoAdvanceTimerRef.current !== null) {
121 + window.clearTimeout(autoAdvanceTimerRef.current);
122 + }
123 + autoAdvanceTimerRef.current = window.setTimeout(() => {
124 + autoAdvanceTimerRef.current = null;
125 + onAdvanceRef.current();
126 + }, 200);
127 + },
128 + [activeQuestion, onToggleOption],
129 + );
130
131 // Keyboard shortcut: number keys 1-9 select corresponding options when focus is
132 // outside editable fields. Multi-select prompts toggle options in place; single-
@@ -154,7 +157,7 @@ const ComposerPendingUserInputCard = memo(function ComposerPendingUserInputCard(
157 };
158 document.addEventListener("keydown", handler);
159 return () => document.removeEventListener("keydown", handler);
157 - }, [activeQuestion, isCollapsed, isResponding]);
160 + }, [activeQuestion, handleOptionSelection, isCollapsed, isResponding]);
161
162 if (!activeQuestion) {
163 return null;