mirror of
https://github.com/zjs81/meshcore-open.git
synced 2026-07-17 14:20:49 +10:00
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:
@@ -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