From f1491749d5524dd2d00f944dd55ae31c9d862a7d Mon Sep 17 00:00:00 2001 From: Yandrik Date: Tue, 5 May 2026 20:02:04 +0200 Subject: [PATCH] fix: bootloader device card persistence fix --- lib/pages/devices_tab_page.dart | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/lib/pages/devices_tab_page.dart b/lib/pages/devices_tab_page.dart index 35f6ad5..5b32283 100644 --- a/lib/pages/devices_tab_page.dart +++ b/lib/pages/devices_tab_page.dart @@ -47,6 +47,7 @@ class _DevicesTabPageState extends ConsumerState { return; } _isBootloaderScanStarting = true; + _clearBootloaderDevice(); try { final bluetooth = await ref.read(bluetoothProvider.future); @@ -83,7 +84,16 @@ class _DevicesTabPageState extends ConsumerState { (device) => device != null && _isBootloaderAdvertisement(device), orElse: () => null, ); - if (!mounted || dfuDevice == null || dfuDevice.id == _dfuDevice?.id) { + if (!mounted) { + return; + } + + if (dfuDevice == null) { + _clearBootloaderDevice(); + return; + } + + if (dfuDevice.id == _dfuDevice?.id) { return; } @@ -92,6 +102,16 @@ class _DevicesTabPageState extends ConsumerState { }); } + void _clearBootloaderDevice() { + if (!mounted || _dfuDevice == null) { + return; + } + + setState(() { + _dfuDevice = null; + }); + } + bool _isBootloaderAdvertisement(DiscoveredDevice device) { final name = device.name.trim(); if (name == 'US-DFU' || name == 'UniversalShifters DFU') { @@ -126,6 +146,7 @@ class _DevicesTabPageState extends ConsumerState { if (!mounted) { return; } + _clearBootloaderDevice(); context.push( '/bootloader_recovery_update', extra: BootloaderRecoveryUpdateArgs(