fix(bluetooth): sync toggle state with device connection

This commit is contained in:
MarcoMadera
2025-04-27 21:18:06 -07:00
parent 0b5a59bfbc
commit d63fb4051f
@@ -56,9 +56,13 @@ const BluetoothDevice = (device) => {
onChange: (self, newValue) => { onChange: (self, newValue) => {
device.setConnection(newValue); device.setConnection(newValue);
}, },
extraSetup: (self) => self.hook(device, (self) => { extraSetup: (self) => {
Utils.timeout(200, () => self.enabled.value = device.connected); self.hook(device, () => {
}), const enabledState = self.attribute.enabled;
if (enabledState.value !== device.connected)
enabledState.value = device.connected;
});
},
}) })
const deviceRemoveButton = Button({ const deviceRemoveButton = Button({
vpack: 'center', vpack: 'center',