refresh_slots: always call sync_slot_overlays, even on early-return paths (Bug #10)

Bug from Grok round-1 #10. Two branches in refresh_slots (the
routing-on and routing-off arms) returned early after finish_vfx, so
sync_slot_overlays at the bottom of the function was skipped. That
meant the slot-number overlay hub could lag by up to a full tick
when the user switched focus into or out of the team.

Both early-return branches now bind the finish_vfx result, call
sync_slot_overlays, and return the bound result.

cargo test 96+/0; clippy clean.
This commit is contained in:
en 2026-09-16 08:03:48 +02:00
parent 3dbc1b11df
commit a36443bd86

View File

@ -223,7 +223,11 @@ async fn refresh_slots(
let mut g = session.lock().await; let mut g = session.lock().await;
g.binds_on = true; g.binds_on = true;
tracing::info!("routing on ({} binds)", specs.len()); tracing::info!("routing on ({} binds)", specs.len());
return finish_vfx(g, vfx_tx, hub, cursor).await; let r = finish_vfx(g, vfx_tx, hub, cursor).await;
// Bug #10: don't drop sync_slot_overlays on early-return
// paths. The non-early path below already calls it.
sync_slot_overlays(session, slot_hub).await;
return r;
} }
} else if g.binds_on { } else if g.binds_on {
g.binds_on = false; g.binds_on = false;
@ -232,7 +236,10 @@ async fn refresh_slots(
hypr::clear_binds().await.ok(); hypr::clear_binds().await.ok();
tracing::info!("routing off (focus left the team)"); tracing::info!("routing off (focus left the team)");
let g = session.lock().await; let g = session.lock().await;
return finish_vfx(g, vfx_tx, hub, cursor).await; let r = finish_vfx(g, vfx_tx, hub, cursor).await;
// Bug #10: keep this in sync with the early-return above.
sync_slot_overlays(session, slot_hub).await;
return r;
} }
} }