From e1327a93c74d82a8ce4acb0014e9cbef97e26d0d Mon Sep 17 00:00:00 2001 From: zjs81 Date: Sat, 7 Mar 2026 13:00:23 -0700 Subject: [PATCH] Fix contact sync fallback when channel 0 never arrives On web BLE, contact sync is deferred until channel 0 arrives via _handleChannelInfo. If channel 0 times out or channel sync completes without it, _pendingInitialContactsSync stays true and contacts never load. Add fallback in _cleanupChannelSync to trigger getContacts() if the flag is still set when channel sync ends. --- lib/connector/meshcore_connector.dart | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/lib/connector/meshcore_connector.dart b/lib/connector/meshcore_connector.dart index 4fa8412f..0c584367 100644 --- a/lib/connector/meshcore_connector.dart +++ b/lib/connector/meshcore_connector.dart @@ -2250,6 +2250,14 @@ class MeshCoreConnector extends ChangeNotifier { _hasLoadedChannels = true; _previousChannelsCache.clear(); } + + // Fallback: if contact sync was deferred waiting for channel 0 but + // channel sync finished without triggering it, start contacts now. + if (_pendingInitialContactsSync && isConnected) { + _pendingInitialContactsSync = false; + unawaited(getContacts()); + } + // Keep cache on failure/disconnection for future attempts }