File tree Expand file tree Collapse file tree 1 file changed +14
-10
lines changed
crates/matrix-sdk-ui/src/spaces Expand file tree Collapse file tree 1 file changed +14
-10
lines changed Original file line number Diff line number Diff line change 14
14
15
15
use std:: sync:: Arc ;
16
16
17
- use eyeball:: { SharedObservable , Subscriber } ;
17
+ use eyeball:: { ObservableWriteGuard , SharedObservable , Subscriber } ;
18
18
use eyeball_im:: { ObservableVector , VectorSubscriberBatchedStream } ;
19
19
use futures_util:: pin_mut;
20
20
use imbl:: Vector ;
@@ -192,17 +192,21 @@ impl SpaceRoomList {
192
192
/// Ask the list to retrieve the next page if the end hasn't been reached
193
193
/// yet. Otherwise it no-ops.
194
194
pub async fn paginate ( & self ) -> Result < ( ) , Error > {
195
- match * self . pagination_state . read ( ) {
196
- SpaceRoomListPaginationState :: Idle { end_reached } if end_reached => {
197
- return Ok ( ( ) ) ;
198
- }
199
- SpaceRoomListPaginationState :: Loading => {
200
- return Ok ( ( ) ) ;
195
+ {
196
+ let mut pagination_state = self . pagination_state . write ( ) ;
197
+
198
+ match * pagination_state {
199
+ SpaceRoomListPaginationState :: Idle { end_reached } if end_reached => {
200
+ return Ok ( ( ) ) ;
201
+ }
202
+ SpaceRoomListPaginationState :: Loading => {
203
+ return Ok ( ( ) ) ;
204
+ }
205
+ _ => { }
201
206
}
202
- _ => { }
203
- }
204
207
205
- self . pagination_state . set_if_not_eq ( SpaceRoomListPaginationState :: Loading ) ;
208
+ ObservableWriteGuard :: set ( & mut pagination_state, SpaceRoomListPaginationState :: Loading ) ;
209
+ }
206
210
207
211
let mut request = get_hierarchy:: v1:: Request :: new ( self . parent_space_id . clone ( ) ) ;
208
212
request. max_depth = Some ( uint ! ( 1 ) ) ; // We only want the immediate children of the space
You can’t perform that action at this time.
0 commit comments