File tree Expand file tree Collapse file tree
crates/matrix-sdk/src/sliding_sync Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -186,15 +186,27 @@ impl SlidingSync {
186186 cancel_in_flight_request : bool ,
187187 ) {
188188 let mut room_subscriptions = self . inner . room_subscriptions . write ( ) . unwrap ( ) ;
189- room_subscriptions. clear ( ) ;
189+
190+ // Remove rooms that are no longer subscribed.
191+ let to_remove: Vec < _ > = room_ids
192+ . iter ( )
193+ . filter ( |room_id| room_subscriptions. contains_key ( * room_id. to_owned ( ) ) )
194+ . collect ( ) ;
195+ let mut any_removed = false ;
196+ for room_id in to_remove {
197+ if room_subscriptions. remove ( * room_id) . is_some ( ) {
198+ any_removed = true ;
199+ }
200+ }
190201
191202 if subscribe_to_rooms (
192203 room_subscriptions,
193204 & self . inner . client ,
194205 room_ids,
195206 settings,
196207 cancel_in_flight_request,
197- ) {
208+ ) || any_removed
209+ {
198210 self . inner . internal_channel_send_if_possible (
199211 SlidingSyncInternalMessage :: SyncLoopSkipOverCurrentIteration ,
200212 ) ;
You can’t perform that action at this time.
0 commit comments