The best way to control Claude Code, Codex and more from any computer or phone
fix(web): Enter no longer skips an unanswered question (#23626)
Co-authored-by: maria-rcks <maria@kuuro.net>
Mantas Kantautas committed
Oct 29, 2026 at 19:51 UTC
6ca95bd92a066108a04f854b858908e942e5b322
2 files changed
+47
-9
apps/web/src/components/chat/ComposerPendingUserInputPanel.navigation.browser.test.tsx
+46
-9
@@ -9,6 +9,7 @@ import {
9
import { makeThreadRequestsResolvedAnnouncer } from "@t3tools/client-runtime/state/thread-requests";
10
import { useLayoutEffect, useRef, type ComponentProps } from "react";
11
import { expect, it, vi } from "vite-plus/test";
12
+import { userEvent } from "vite-plus/test/browser";
13
14
vi.mock(import("../ChatMarkdown"), async (importOriginal) => ({
15
...(await importOriginal()),
@@ -73,20 +74,16 @@ function questionProjection(threadId: ThreadId, requestIds = ["first", "second"]
74
} satisfies OrchestrationV2ThreadProjection;
75
}
76
76
-let requests: ReturnType<typeof usePendingThreadRequests>;
77
-
78
-function PendingRequestsProbe({
79
- environmentId,
80
- projection,
81
- loading = false,
82
-}: {
77
+interface ProbeProps {
78
environmentId: EnvironmentId;
79
projection: OrchestrationV2ThreadProjection;
80
loading?: boolean;
86
-}) {
81
+}
82
+
83
+function useProbeRequests({ environmentId, projection, loading = false }: ProbeProps) {
84
const promptRef = useRef("");
85
const composerRef = useRef(null);
89
- const state = usePendingThreadRequests({
86
+ return usePendingThreadRequests({
87
environmentId,
88
activeThreadId: projection.thread.id,
89
serverProjection: loading ? null : projection,
@@ -97,6 +94,12 @@ function PendingRequestsProbe({
94
composerRef,
95
setThreadError: () => {},
96
});
97
+}
98
+
99
+let requests: ReturnType<typeof usePendingThreadRequests>;
100
+
101
+function PendingRequestsProbe(props: ProbeProps) {
102
+ const state = useProbeRequests(props);
103
useLayoutEffect(() => {
104
requests = state;
105
});
@@ -138,6 +141,40 @@ it("retains answers, selections and question position after leaving chat, includ
141
expect(requests).toMatchObject(expected);
142
});
143
144
+function QuestionPositionProbe(props: ProbeProps) {
145
+ const state = useProbeRequests(props);
146
+ return (
147
+ <>
148
+ <output>Question {state.activePendingQuestionIndex + 1}</output>
149
+ <button
150
+ type="button"
151
+ onClick={() => state.onSelectActivePendingUserInputOption("question-0", "Incremental")}
152
+ >
153
+ Choose Incremental
154
+ </button>
155
+ <button type="button" onClick={() => state.onAdvanceActivePendingUserInput()}>
156
+ Submit
157
+ </button>
158
+ </>
159
+ );
160
+}
161
+
162
+it("stays on an unanswered question when the composer submits", async () => {
163
+ await using screen = await render(
164
+ <QuestionPositionProbe
165
+ environmentId={EnvironmentId.make("unanswered-environment")}
166
+ projection={questionProjection(threadRef.threadId)}
167
+ />,
168
+ );
169
+ const submit = screen.getByRole("button", { name: "Submit" });
170
+ await userEvent.click(submit);
171
+ await expect.element(screen.getByRole("status")).toHaveTextContent("Question 1");
172
+
173
+ await userEvent.click(screen.getByRole("button", { name: "Choose Incremental" }));
174
+ await userEvent.click(submit);
175
+ await expect.element(screen.getByRole("status")).toHaveTextContent("Question 2");
176
+});
177
+
178
it("isolates drafts by environment, thread and request and discards only resolved requests", async () => {
179
using _timers = fakeTimers();
180
const environmentId = EnvironmentId.make("scope-environment");
apps/web/src/components/chat/usePendingThreadRequests.ts
+1
@@ -473,6 +473,7 @@ export function usePendingThreadRequests(input: {
473
}
474
return;
475
}
476
+ if (!activePendingProgress.canAdvance) return;
477
setActivePendingUserInputQuestionIndex(activePendingProgress.questionIndex + 1);
478
};
479
const onAdvanceActivePendingUserInputStable = useStableCallback(onAdvanceActivePendingUserInput);