Fix roomlist not updating live
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
a05b96e9a0
commit
6b9c8b7a87
1 changed files with 10 additions and 0 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue