mirror of
https://github.com/gesellix/Bose-SoundTouch.git
synced 2026-09-07 15:07:17 +00:00
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:
co-authored by
Claude Opus 5
parent
8eb719c4d4
commit
098cc1c66f
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user