fix: clean up stale sorter entries and fix battery reactivity
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 5m44s
All checks were successful
Build and Push Docker Image to Gitea / build-and-push (push) Successful in 5m44s
ButtplugMessageSorter never deleted entries from _waitingMsgs after resolving, causing unsolicited DeviceList messages (with reused Ids) to be swallowed. Also fix battery level not updating in UI by accessing the device through the Svelte $state proxy array. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -63,10 +63,11 @@ async function onDeviceAdded(dev: ButtplugClientDevice) {
|
||||
const device = convertDevice(dev);
|
||||
devices.push(device);
|
||||
|
||||
// Try to read battery level
|
||||
// Try to read battery level — access through the reactive array so Svelte detects the mutation
|
||||
const idx = devices.length - 1;
|
||||
if (device.hasBattery) {
|
||||
try {
|
||||
device.batteryLevel = await dev.battery();
|
||||
devices[idx].batteryLevel = await dev.battery();
|
||||
} catch (e) {
|
||||
console.warn(`Failed to read battery for ${dev.name}:`, e);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user