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.
This commit is contained in:
1 parent
421bc71bb7
commit
e1327a93c7
1 file changed
+8
@@ -2250,6 +2250,14 @@ class MeshCoreConnector extends ChangeNotifier {
|
|||||||
_hasLoadedChannels = true;
|
_hasLoadedChannels = true;
|
||||||
_previousChannelsCache.clear();
|
_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
|
// Keep cache on failure/disconnection for future attempts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user