Fix cyclic dependency in initMatrix

Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
Ajay Bura 2022-03-18 09:22:16 +05:30
parent 8330f4fba9
commit 6010b4c252
2 changed files with 5 additions and 4 deletions

View file

@ -1,6 +1,9 @@
import React, { useState, useEffect } from 'react'; import React, { useState, useEffect } from 'react';
import './Client.scss'; import './Client.scss';
import { initHotkeys } from '../../../client/event/hotkeys';
import { initRoomListListener } from '../../../client/event/roomList';
import Text from '../../atoms/text/Text'; import Text from '../../atoms/text/Text';
import Spinner from '../../atoms/spinner/Spinner'; import Spinner from '../../atoms/spinner/Spinner';
import Navigation from '../../organisms/navigation/Navigation'; import Navigation from '../../organisms/navigation/Navigation';
@ -38,6 +41,8 @@ function Client() {
}, 15000); }, 15000);
initMatrix.once('init_loading_finished', () => { initMatrix.once('init_loading_finished', () => {
clearInterval(iId); clearInterval(iId);
initHotkeys();
initRoomListListener(initMatrix.roomList);
changeLoading(false); changeLoading(false);
}); });
initMatrix.init(); initMatrix.init();

View file

@ -7,8 +7,6 @@ import RoomList from './state/RoomList';
import AccountData from './state/AccountData'; import AccountData from './state/AccountData';
import RoomsInput from './state/RoomsInput'; import RoomsInput from './state/RoomsInput';
import Notifications from './state/Notifications'; import Notifications from './state/Notifications';
import { initHotkeys } from './event/hotkeys';
import { initRoomListListener } from './event/roomList';
global.Olm = require('@matrix-org/olm'); global.Olm = require('@matrix-org/olm');
@ -66,8 +64,6 @@ class InitMatrix extends EventEmitter {
this.accountData = new AccountData(this.roomList); this.accountData = new AccountData(this.roomList);
this.roomsInput = new RoomsInput(this.matrixClient); this.roomsInput = new RoomsInput(this.matrixClient);
this.notifications = new Notifications(this.roomList); this.notifications = new Notifications(this.roomList);
initHotkeys();
initRoomListListener(this.roomList);
this.emit('init_loading_finished'); this.emit('init_loading_finished');
} }
}, },