Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions apps/web/src/hooks/useHandleNewThread.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,13 @@ export function useHandleNewThread() {
...(hasEnvModeOption ? { envMode: options?.envMode } : {}),
});
}
if (stickyModel) {
setProvider(storedDraftThread.threadId, inferProviderForModel(stickyModel));
setModel(storedDraftThread.threadId, stickyModel);
}
if (Object.keys(stickyModelOptions).length > 0) {
setModelOptions(storedDraftThread.threadId, stickyModelOptions);
}
Comment on lines +66 to +72
Copy link

Copilot AI Mar 22, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This adds sticky model/modelOptions application when reusing a stored draft thread, but the other reuse path (when latestActiveDraftThread exists for the same project and you return early around lines 86–100) still doesn’t apply stickyModel/stickyModelOptions. If the project->draft mapping is missing but the user is currently on a draft thread, clicking “New Thread” can still leave the draft on an outdated/default model. Consider applying the same sticky-model update in that early-return branch (or factor the sticky application into a shared helper).

Copilot uses AI. Check for mistakes.
setProjectDraftThreadId(projectId, storedDraftThread.threadId);
if (routeThreadId === storedDraftThread.threadId) {
return;
Expand All @@ -88,6 +95,13 @@ export function useHandleNewThread() {
...(hasEnvModeOption ? { envMode: options?.envMode } : {}),
});
}
if (stickyModel) {
setProvider(routeThreadId, inferProviderForModel(stickyModel));
setModel(routeThreadId, stickyModel);
}
if (Object.keys(stickyModelOptions).length > 0) {
setModelOptions(routeThreadId, stickyModelOptions);
}
setProjectDraftThreadId(projectId, routeThreadId);
return Promise.resolve();
}
Expand Down