From 6b9c8b7a87383a543f98371edee3a3d50863e2e2 Mon Sep 17 00:00:00 2001 From: Ajay Bura Date: Thu, 3 Mar 2022 18:46:47 +0530 Subject: [PATCH] Fix roomlist not updating live Signed-off-by: Ajay Bura --- src/app/organisms/navigation/Drawer.jsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app/organisms/navigation/Drawer.jsx b/src/app/organisms/navigation/Drawer.jsx index 10b047f..8e3e4ea 100644 --- a/src/app/organisms/navigation/Drawer.jsx +++ b/src/app/organisms/navigation/Drawer.jsx @@ -13,6 +13,7 @@ import DrawerBreadcrumb from './DrawerBreadcrumb'; import Home from './Home'; import Directs from './Directs'; +import { useForceUpdate } from '../../hooks/useForceUpdate'; import { useSelectedTab } from '../../hooks/useSelectedTab'; import { useSelectedSpace } from '../../hooks/useSelectedSpace'; @@ -39,8 +40,17 @@ function Drawer() { const [systemState] = useSystemState(); const [selectedTab] = useSelectedTab(); const [spaceId] = useSelectedSpace(); + const [, forceUpdate] = useForceUpdate(); const scrollRef = useRef(null); + useEffect(() => { + const { roomList } = initMatrix; + roomList.on(cons.events.roomList.ROOMLIST_UPDATED, forceUpdate); + return () => { + roomList.removeListener(cons.events.roomList.ROOMLIST_UPDATED, forceUpdate); + }; + }, []); + useEffect(() => { requestAnimationFrame(() => { scrollRef.current.scrollTop = 0;