fix(desktop): resync Share model field when served model changes

The card mirrored the running node's modelId into the field only when the
field was empty, so switching models (node restarts on the new one) left the
field showing the stale model. Sync whenever the served model differs from the
field; safe from clobbering a mid-edit because the field is disabled while the
slot is occupied.
This commit is contained in:
Michael Neale
2026-07-23 15:29:15 +10:00
parent c79c76fa91
commit 2a72d94f39

View File

@@ -125,9 +125,17 @@ export function MeshComputeSettingsCard() {
}, []);
// Mirror the running node's modelId back into the field so the card shows
// what's actually being served, even after a fresh app load.
// what's ACTUALLY being served — not just on a fresh load (empty field) but
// whenever the served model differs from the field (e.g. the member switched
// models and the node restarted on the new one). This is safe from clobbering
// a mid-edit because the field is disabled whenever the slot is occupied
// (`controlsDisabled`), so the user can't be typing while a node is running.
React.useEffect(() => {
if (status?.state === "running" && status.modelId && modelInput === "") {
if (
status?.state === "running" &&
status.modelId &&
status.modelId !== modelInput
) {
setModelInput(status.modelId);
writeDraft(MODEL_DRAFT_STORAGE_KEY, status.modelId);
}