mirror of
https://github.com/vector-im/element-web.git
synced 2026-05-04 19:56:45 +02:00
refactor: listen to RoomEvent.Tags instead of relying on the old room list store to update the summary card (#32728)
This commit is contained in:
parent
83d732d60e
commit
9035da48a2
@ -5,7 +5,14 @@ Please see LICENSE files in the repository root for full details.
|
||||
*/
|
||||
|
||||
import { useEffect, useRef, useState } from "react";
|
||||
import { EventType, type HistoryVisibility, type JoinRule, type Room, RoomStateEvent } from "matrix-js-sdk/src/matrix";
|
||||
import {
|
||||
EventType,
|
||||
type HistoryVisibility,
|
||||
type JoinRule,
|
||||
type Room,
|
||||
RoomEvent,
|
||||
RoomStateEvent,
|
||||
} from "matrix-js-sdk/src/matrix";
|
||||
|
||||
import { useMatrixClientContext } from "../../../contexts/MatrixClientContext";
|
||||
import { useIsEncrypted } from "../../../hooks/useIsEncrypted";
|
||||
@ -17,7 +24,6 @@ import { useAccountData } from "../../../hooks/useAccountData";
|
||||
import { useDispatcher } from "../../../hooks/useDispatcher";
|
||||
import defaultDispatcher from "../../../dispatcher/dispatcher";
|
||||
import { Action } from "../../../dispatcher/actions";
|
||||
import RoomListStore, { LISTS_UPDATE_EVENT } from "../../../stores/room-list/RoomListStore";
|
||||
import { canInviteTo } from "../../../utils/room/canInviteTo";
|
||||
import { DefaultTagID } from "../../../stores/room-list-v3/skip-list/tag";
|
||||
import { useEventEmitterState } from "../../../hooks/useEventEmitter";
|
||||
@ -172,7 +178,7 @@ export function useRoomSummaryCardViewModel(
|
||||
// value to check if the user can invite to the room
|
||||
const canInviteToState = useEventEmitterState(room, RoomStateEvent.Update, () => canInviteTo(room));
|
||||
|
||||
const roomTags = useEventEmitterState(RoomListStore.instance, LISTS_UPDATE_EVENT, () => getTagsForRoom(room));
|
||||
const roomTags = useEventEmitterState(room, RoomEvent.Tags, () => getTagsForRoom(room));
|
||||
const isFavorite = roomTags.includes(DefaultTagID.Favourite);
|
||||
|
||||
const isDirectMessage = useIsDirectMessage(room);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user