fix(bluetooth): sync toggle state with device connection (#1252)

This commit is contained in:
end-4
2025-04-28 17:08:31 +02:00
committed by GitHub
@@ -56,9 +56,13 @@ const BluetoothDevice = (device) => {
onChange: (self, newValue) => {
device.setConnection(newValue);
},
extraSetup: (self) => self.hook(device, (self) => {
Utils.timeout(200, () => self.enabled.value = device.connected);
}),
extraSetup: (self) => {
self.hook(device, () => {
const enabledState = self.attribute.enabled;
if (enabledState.value !== device.connected)
enabledState.value = device.connected;
});
},
})
const deviceRemoveButton = Button({
vpack: 'center',