@@ -91,7 +91,6 @@ import { RoomResultContextMenus } from "./RoomResultContextMenus";
91
91
import { RoomContextDetails } from "../../rooms/RoomContextDetails" ;
92
92
import { TooltipOption } from "./TooltipOption" ;
93
93
import { isLocalRoom } from "../../../../utils/localRoom/isLocalRoom" ;
94
- import { useSlidingSyncRoomSearch } from "../../../../hooks/useSlidingSyncRoomSearch" ;
95
94
import { shouldShowFeedback } from "../../../../utils/Feedback" ;
96
95
import RoomAvatar from "../../avatars/RoomAvatar" ;
97
96
@@ -342,43 +341,26 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
342
341
searchProfileInfo ,
343
342
searchParams ,
344
343
) ;
345
- const isSlidingSyncEnabled = SettingsStore . getValue ( "feature_sliding_sync" ) ;
346
- let {
347
- loading : slidingSyncRoomSearchLoading ,
348
- rooms : slidingSyncRooms ,
349
- search : searchRoomsServerside ,
350
- } = useSlidingSyncRoomSearch ( ) ;
351
- useDebouncedCallback ( isSlidingSyncEnabled , searchRoomsServerside , searchParams ) ;
352
- if ( ! isSlidingSyncEnabled ) {
353
- slidingSyncRoomSearchLoading = false ;
354
- }
355
344
356
345
const possibleResults = useMemo < Result [ ] > (
357
346
( ) => {
358
347
const userResults : IMemberResult [ ] = [ ] ;
359
- let roomResults : IRoomResult [ ] ;
360
- let alreadyAddedUserIds : Set < string > ;
361
- if ( isSlidingSyncEnabled ) {
362
- // use the rooms sliding sync returned as the server has already worked it out for us
363
- roomResults = slidingSyncRooms . map ( toRoomResult ) ;
364
- } else {
365
- roomResults = findVisibleRooms ( cli ) . map ( toRoomResult ) ;
366
- // If we already have a DM with the user we're looking for, we will
367
- // show that DM instead of the user themselves
368
- alreadyAddedUserIds = roomResults . reduce ( ( userIds , result ) => {
369
- const userId = DMRoomMap . shared ( ) . getUserIdForRoomId ( result . room . roomId ) ;
370
- if ( ! userId ) return userIds ;
371
- if ( result . room . getJoinedMemberCount ( ) > 2 ) return userIds ;
372
- userIds . add ( userId ) ;
373
- return userIds ;
374
- } , new Set < string > ( ) ) ;
375
- for ( const user of [ ...findVisibleRoomMembers ( cli ) , ...users ] ) {
376
- // Make sure we don't have any user more than once
377
- if ( alreadyAddedUserIds . has ( user . userId ) ) continue ;
378
- alreadyAddedUserIds . add ( user . userId ) ;
379
-
380
- userResults . push ( toMemberResult ( user ) ) ;
381
- }
348
+ const roomResults = findVisibleRooms ( cli ) . map ( toRoomResult ) ;
349
+ // If we already have a DM with the user we're looking for, we will
350
+ // show that DM instead of the user themselves
351
+ const alreadyAddedUserIds = roomResults . reduce ( ( userIds , result ) => {
352
+ const userId = DMRoomMap . shared ( ) . getUserIdForRoomId ( result . room . roomId ) ;
353
+ if ( ! userId ) return userIds ;
354
+ if ( result . room . getJoinedMemberCount ( ) > 2 ) return userIds ;
355
+ userIds . add ( userId ) ;
356
+ return userIds ;
357
+ } , new Set < string > ( ) ) ;
358
+ for ( const user of [ ...findVisibleRoomMembers ( cli ) , ...users ] ) {
359
+ // Make sure we don't have any user more than once
360
+ if ( alreadyAddedUserIds . has ( user . userId ) ) continue ;
361
+ alreadyAddedUserIds . add ( user . userId ) ;
362
+
363
+ userResults . push ( toMemberResult ( user ) ) ;
382
364
}
383
365
384
366
return [
@@ -402,7 +384,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
402
384
...publicRooms . map ( toPublicRoomResult ) ,
403
385
] . filter ( result => filter === null || result . filter . includes ( filter ) ) ;
404
386
} ,
405
- [ cli , users , profile , publicRooms , slidingSyncRooms , isSlidingSyncEnabled , filter ] ,
387
+ [ cli , users , profile , publicRooms , filter ] ,
406
388
) ;
407
389
408
390
const results = useMemo < Record < Section , Result [ ] > > ( ( ) => {
@@ -421,13 +403,10 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
421
403
422
404
possibleResults . forEach ( entry => {
423
405
if ( isRoomResult ( entry ) ) {
424
- // sliding sync gives the correct rooms in the list so we don't need to filter
425
- if ( ! isSlidingSyncEnabled ) {
426
- if ( ! entry . room . normalizedName ?. includes ( normalizedQuery ) &&
427
- ! entry . room . getCanonicalAlias ( ) ?. toLowerCase ( ) . includes ( lcQuery ) &&
428
- ! entry . query ?. some ( q => q . includes ( lcQuery ) )
429
- ) return ; // bail, does not match query
430
- }
406
+ if ( ! entry . room . normalizedName ?. includes ( normalizedQuery ) &&
407
+ ! entry . room . getCanonicalAlias ( ) ?. toLowerCase ( ) . includes ( lcQuery ) &&
408
+ ! entry . query ?. some ( q => q . includes ( lcQuery ) )
409
+ ) return ; // bail, does not match query
431
410
} else if ( isMemberResult ( entry ) ) {
432
411
if ( ! entry . query ?. some ( q => q . includes ( lcQuery ) ) ) return ; // bail, does not match query
433
412
} else if ( isPublicRoomResult ( entry ) ) {
@@ -478,7 +457,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
478
457
}
479
458
480
459
return results ;
481
- } , [ trimmedQuery , filter , cli , possibleResults , isSlidingSyncEnabled , memberComparator ] ) ;
460
+ } , [ trimmedQuery , filter , cli , possibleResults , memberComparator ] ) ;
482
461
483
462
const numResults = sum ( Object . values ( results ) . map ( it => it . length ) ) ;
484
463
useWebSearchMetrics ( numResults , query . length , true ) ;
@@ -1236,7 +1215,7 @@ const SpotlightDialog: React.FC<IProps> = ({ initialText = "", initialFilter = n
1236
1215
aria-label = { _t ( "Search" ) }
1237
1216
aria-describedby = "mx_SpotlightDialog_keyboardPrompt"
1238
1217
/>
1239
- { ( publicRoomsLoading || peopleLoading || profileLoading || slidingSyncRoomSearchLoading ) && (
1218
+ { ( publicRoomsLoading || peopleLoading || profileLoading ) && (
1240
1219
< Spinner w = { 24 } h = { 24 } />
1241
1220
) }
1242
1221
</ div >
0 commit comments