From 421a97017c8c1961fbccfcbbcb81c3d08648dae3 Mon Sep 17 00:00:00 2001 From: Germain Date: Wed, 30 Aug 2023 17:44:55 +0100 Subject: [PATCH] Remove dead code --- src/hooks/useAccountData.ts | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/src/hooks/useAccountData.ts b/src/hooks/useAccountData.ts index b9399c25ea8..d59910d5033 100644 --- a/src/hooks/useAccountData.ts +++ b/src/hooks/useAccountData.ts @@ -15,7 +15,7 @@ limitations under the License. */ import { useCallback, useState } from "react"; -import { ClientEvent, MatrixClient, MatrixEvent, Room, RoomEvent } from "matrix-js-sdk/src/matrix"; +import { ClientEvent, MatrixClient, MatrixEvent } from "matrix-js-sdk/src/matrix"; import { useTypedEventEmitter } from "./useEventEmitter"; @@ -37,18 +37,20 @@ export const useAccountData = (cli: MatrixClient, eventType: strin return value || ({} as T); }; -// Hook to simplify listening to Matrix room account data -export const useRoomAccountData = (room: Room, eventType: string): T => { - const [value, setValue] = useState(() => tryGetContent(room.getAccountData(eventType))); +// Currently not used, commenting out otherwise the dead code CI is unhappy. +// But this code is valid and probably will be needed. - const handler = useCallback( - (event) => { - if (event.getType() !== eventType) return; - setValue(event.getContent()); - }, - [eventType], - ); - useTypedEventEmitter(room, RoomEvent.AccountData, handler); +// export const useRoomAccountData = (room: Room, eventType: string): T => { +// const [value, setValue] = useState(() => tryGetContent(room.getAccountData(eventType))); - return value || ({} as T); -}; +// const handler = useCallback( +// (event) => { +// if (event.getType() !== eventType) return; +// setValue(event.getContent()); +// }, +// [eventType], +// ); +// useTypedEventEmitter(room, RoomEvent.AccountData, handler); + +// return value || ({} as T); +// };