diff --git a/lib/src/core/room.dart b/lib/src/core/room.dart index 2ebcbf360..61f02a408 100644 --- a/lib/src/core/room.dart +++ b/lib/src/core/room.dart @@ -555,10 +555,8 @@ class Room extends DisposableChangeNotifier with EventsEmittable { final isNew = !_remoteParticipants.containsKey(info.identity); - if (info.state == lk_models.ParticipantInfo_State.DISCONNECTED && - !isNew) { - hasChanged = true; - await _handleParticipantDisconnect(info.identity); + if (info.state == lk_models.ParticipantInfo_State.DISCONNECTED) { + hasChanged = await _handleParticipantDisconnect(info.identity); continue; } @@ -697,15 +695,16 @@ class Room extends DisposableChangeNotifier with EventsEmittable { events.emit(event); } - Future _handleParticipantDisconnect(String identity) async { + Future _handleParticipantDisconnect(String identity) async { final participant = _remoteParticipants.remove(identity); if (participant == null) { - return; + return false; } await participant.removeAllPublishedTracks(notify: true); emitWhenConnected(ParticipantDisconnectedEvent(participant: participant)); + return true; } Future _sendSyncState() async {