@@ -18,7 +18,7 @@ import SpaceStore from "../../../stores/spaces/SpaceStore";
18
18
import dispatcher from "../../../dispatcher/dispatcher" ;
19
19
import { Action } from "../../../dispatcher/actions" ;
20
20
import { useMatrixClientContext } from "../../../contexts/MatrixClientContext" ;
21
- import { useIndexForActiveRoom } from "./useIndexForActiveRoom " ;
21
+ import { useStickyRoomList } from "./useStickyRoomList " ;
22
22
23
23
export interface RoomListViewState {
24
24
/**
@@ -97,8 +97,14 @@ export interface RoomListViewState {
97
97
*/
98
98
export function useRoomListViewModel ( ) : RoomListViewState {
99
99
const matrixClient = useMatrixClientContext ( ) ;
100
- const { primaryFilters, activePrimaryFilter, rooms, activateSecondaryFilter, activeSecondaryFilter } =
101
- useFilteredRooms ( ) ;
100
+ const {
101
+ primaryFilters,
102
+ activePrimaryFilter,
103
+ rooms : filteredRooms ,
104
+ activateSecondaryFilter,
105
+ activeSecondaryFilter,
106
+ } = useFilteredRooms ( ) ;
107
+ const { activeIndex, rooms } = useStickyRoomList ( filteredRooms ) ;
102
108
103
109
const currentSpace = useEventEmitterState < Room | null > (
104
110
SpaceStore . instance ,
@@ -107,7 +113,6 @@ export function useRoomListViewModel(): RoomListViewState {
107
113
) ;
108
114
const canCreateRoom = hasCreateRoomRights ( matrixClient , currentSpace ) ;
109
115
110
- const activeIndex = useIndexForActiveRoom ( rooms ) ;
111
116
const { activeSortOption, sort } = useSorter ( ) ;
112
117
const { shouldShowMessagePreview, toggleMessagePreview } = useMessagePreviewToggle ( ) ;
113
118
0 commit comments