mirror of
https://github.com/Novaloop-AG/healthchat-web.git
synced 2026-11-03 16:10:05 +00:00
RoomListViewModel: Track the index of the active room in the list (#29519)
* Introduce a hook to track active room This hook simply keeps a state which tracks the index of the active room in the list of rooms passed through props. This index will be recomputed if the active rooms changes or if the list itself changed. * Use hook in the view model * Write tests * Fix broken tests
This commit is contained in:
@@ -31,6 +31,7 @@ describe("<EmptyRoomList />", () => {
|
||||
canCreateRoom: true,
|
||||
shouldShowMessagePreview: false,
|
||||
toggleMessagePreview: jest.fn(),
|
||||
activeIndex: undefined,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@ describe("<RoomList />", () => {
|
||||
createRoom: jest.fn(),
|
||||
createChatRoom: jest.fn(),
|
||||
canCreateRoom: true,
|
||||
activeIndex: undefined,
|
||||
};
|
||||
|
||||
// Needed to render a room list cell
|
||||
|
||||
@@ -34,6 +34,7 @@ describe("<RoomListPrimaryFilters />", () => {
|
||||
activeSortOption: SortOption.Activity,
|
||||
shouldShowMessagePreview: false,
|
||||
toggleMessagePreview: jest.fn(),
|
||||
activeIndex: undefined,
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ describe("<RoomListView />", () => {
|
||||
canCreateRoom: true,
|
||||
toggleMessagePreview: jest.fn(),
|
||||
shouldShowMessagePreview: false,
|
||||
activeIndex: undefined,
|
||||
};
|
||||
const matrixClient = stubClient();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user