Skip to content

Commit 8d22f5b

Browse files
committed
🤖 fix: reset creation model on variant change; align star with grid
_Generated with `mux`_
1 parent 24f44be commit 8d22f5b

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/browser/components/ChatInput/index.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -176,14 +176,14 @@ export const ChatInput: React.FC<ChatInputProps> = (props) => {
176176
[storageKeys.modelKey, addModel]
177177
);
178178

179-
// When entering creation mode, always reset the model selection to the global default.
180-
// We don't want manual selections to persist to subsequent workspace creations.
179+
// When entering creation mode (or when the default model changes), reset the
180+
// project-scoped model to the explicit default so manual picks don't bleed
181+
// into subsequent creation flows.
181182
useEffect(() => {
182183
if (variant === "creation" && defaultModel) {
183184
updatePersistedState(storageKeys.modelKey, defaultModel);
184185
}
185-
// eslint-disable-next-line react-hooks/exhaustive-deps
186-
}, []); // Run once on mount
186+
}, [variant, defaultModel, storageKeys.modelKey]);
187187

188188
// Creation-specific state (hook always called, but only used when variant === "creation")
189189
// This avoids conditional hook calls which violate React rules

src/browser/components/ModelSelector.tsx

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,27 +256,29 @@ export const ModelSelector = forwardRef<ModelSelectorRef, ModelSelectorProps>(
256256
)}
257257
onClick={() => handleSelectModel(model)}
258258
>
259-
<div className="flex items-center justify-between gap-2 w-full">
260-
<span className="truncate flex-1 min-w-0">{model}</span>
261-
<div className="flex items-center gap-1 shrink-0">
259+
<div className="grid w-full grid-cols-[1fr_48px] items-center gap-2">
260+
<span className="min-w-0 truncate">{model}</span>
261+
<div className="grid w-[48px] grid-cols-[22px_22px] justify-items-center gap-1">
262262
{onSetDefaultModel && (
263263
<TooltipWrapper inline>
264264
<button
265265
type="button"
266266
onMouseDown={(e) => e.preventDefault()}
267267
onClick={(e) => handleSetDefault(e, model)}
268268
className={cn(
269-
"rounded-sm border px-1 py-0.5 transition-colors duration-150 flex items-center justify-center",
269+
"flex items-center justify-center rounded-sm border px-1 py-0.5 transition-colors duration-150",
270270
defaultModel === model
271271
? "text-yellow-400 border-yellow-400/40 cursor-default"
272272
: "text-muted-light border-border-light/40 hover:border-foreground/60 hover:text-foreground"
273273
)}
274274
aria-label={
275-
defaultModel === model ? "Current default model" : "Set as default model"
275+
defaultModel === model
276+
? "Current default model"
277+
: "Set as default model"
276278
}
277279
disabled={defaultModel === model}
278280
>
279-
<Star className={cn("h-3 w-3")} />
281+
<Star className="h-3 w-3" />
280282
</button>
281283
<Tooltip className="tooltip" align="center">
282284
{defaultModel === model

0 commit comments

Comments
 (0)