Skip to content

Commit 1e169a6

Browse files
committed
fix(web): new-thread destination can't collide with a thread id
1 parent d30b877 commit 1e169a6

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎apps/web/src/components/settings/ScheduledTasksSettings.tsx‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,8 @@ const WEEKDAY_ORDER = [1, 2, 3, 4, 5, 6, 0] as const;
154154
const WEEKDAY_LABELS = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"] as const;
155155
const WEEKDAY_SHORT = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"] as const;
156156

157-
const NEW_THREAD_DESTINATION = "new-thread";
157+
// Thread ids are trimmed, so the leading space keeps this from matching one.
158+
const NEW_THREAD_DESTINATION = " new-thread";
158159

159160
const WORKSPACE_MODE_LABELS: Record<WorkspaceMode, string> = {
160161
worktree: "Create a new worktree",
@@ -1291,7 +1292,11 @@ function ScheduledTaskDestination({
12911292
onOpenChange={handleOpenChange}
12921293
value={threadId ?? (threadMode === "new_thread" ? NEW_THREAD_DESTINATION : null)}
12931294
onValueChange={(value) => {
1294-
if (value === NEW_THREAD_DESTINATION) onSelect(null);
1295+
if (value === NEW_THREAD_DESTINATION) {
1296+
onSelect(null);
1297+
handleOpenChange(false);
1298+
return;
1299+
}
12951300
const picked = threads.find((row) => row.id === value);
12961301
if (picked) onSelect(picked);
12971302
handleOpenChange(false);

0 commit comments

Comments
 (0)