fix(player): order refreshDevices like the WebSocket frames

The `devices` and `status_update` frames are now applied by revision, but
refreshDevices() still replaced the whole map with whatever the REST call
returned. A refresh issued before a socket update but answered after it
would put the older status back.

Route it through mergeDevicesSnapshot as well. Entries the snapshot omits
are still dropped, so device removal keeps working, and info/stereoPair
still come from the snapshot even when its status loses the comparison.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Tobias Gesellchen
2026-09-05 20:36:58 +02:00
co-authored by Claude Opus 5
parent 8eb719c4d4
commit 098cc1c66f
+3 -1
View File
@@ -246,7 +246,9 @@ function App() {
async function refreshDevices() {
const resp = await api.devices();
if (!resp?.success) throw new Error(resp?.error || 'Failed to refresh devices');
setDevices(resp.data || {});
// Ordered like the WebSocket frames: a slow REST snapshot must not
// clobber a newer status that arrived over the socket meanwhile.
setDevices(previous => mergeDevicesSnapshot(previous, resp.data));
}
function mergeDeviceReadback(deviceId, status) {