Skip to content

A desktop coding agent with free access to frontier models.

TypeScript

fix: model popup comes before the effort step

ogsamrat9d986fcf38c9
diff --git a/apps/app/src/components/model-select.tsx b/apps/app/src/components/model-select.tsx
index e33c4c43..0afc6c43 100644
--- a/apps/app/src/components/model-select.tsx
+++ b/apps/app/src/components/model-select.tsx
@@ -384,28 +384,36 @@ export function ModelSelect({
&& selectedThinkingOptions.length > 0
&& Boolean(effectiveBehaviorLabel);
+ const closePicker = () => {
+ setSearch("");
+ setThinkingFor(null);
+ setPane("root");
+ onOpenChange(false);
+ };
+
+ // The route may take the pick instead (a new-chat popup, Claude, a message); a plain switch is not taken.
+ const routeTakesPick = (option: ModelOption) =>
+ useModelPickGate.getState().intercept({ providerID: option.providerID, modelID: option.modelID }, sessionId ?? null);
+
const applyModel = (option: ModelOption, behavior?: string | null) => {
- const next = { providerID: option.providerID, modelID: option.modelID };
- // The route may take the pick instead (a new-chat popup, Claude, a message).
- if (useModelPickGate.getState().intercept(next, sessionId ?? null)) {
- setSearch("");
- setThinkingFor(null);
- setPane("root");
- onOpenChange(false);
+ if (routeTakesPick(option)) {
+ closePicker();
return;
}
useModelCollectionsStore.getState().recordRecent(option);
- onChange(next, behavior);
+ onChange({ providerID: option.providerID, modelID: option.modelID }, behavior);
if (behavior !== undefined) {
onBehaviorChange?.(behavior);
}
- setSearch("");
- setThinkingFor(null);
- setPane("root");
- onOpenChange(false);
+ closePicker();
};
const handleSelect = (option: ModelOption) => {
+ // Before the effort step: a pick the route takes never asks for an effort first.
+ if (routeTakesPick(option)) {
+ closePicker();
+ return;
+ }
const thinking = thinkingOptionsFor(option);
if (thinking.length > 0 && onBehaviorChange) {
setThinkingFor(option);