mirror of
https://github.com/block/buzz.git
synced 2026-11-24 18:21:59 +00:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user