remove unused events

This commit is contained in:
Abhinav 2023-02-09 22:24:10 +05:30
parent 6d5387432d
commit 51707d55c6
4 changed files with 1 additions and 16 deletions

View file

@ -183,7 +183,6 @@ export default function App({ Component, err }) {
const mlSearchConfig = await getMLSearchConfig();
setMlSearchEnabled(mlSearchConfig.enabled);
mlWorkManager.setMlSearchEnabled(mlSearchConfig.enabled);
eventBus.emit(Events.APP_START);
} catch (e) {
logError(e, 'Error while loading mlSearchEnabled');
}

View file

@ -14,7 +14,6 @@ import { logoutUser } from 'services/userService';
import { isFirstLogin } from 'utils/storage';
import { AppContext } from 'pages/_app';
import { logError } from 'utils/sentry';
import { eventBus, Events } from 'services/events';
import { KeyAttributes, User } from 'types/user';
import FormContainer from 'components/Form/FormContainer';
import FormPaper from 'components/Form/FormPaper';
@ -81,13 +80,6 @@ export default function Credentials() {
keyAttributes,
key
);
// TODO: not required after reseting appContext on first login
appContext.updateMlSearchEnabled(false);
}
try {
eventBus.emit(Events.LOGIN);
} catch (e) {
logError(e, 'Error in login handlers');
}
await saveKeyInSessionStore(SESSION_KEYS.ENCRYPTION_KEY, key);
await decryptAndStoreToken(key);

View file

@ -1,11 +1,9 @@
import { EventEmitter } from 'eventemitter3';
// When registering event handlers,
// handle errors to avoid unhandled rejection or propogation to emit call
// handle errors to avoid unhandled rejection or propagation to emit call
export enum Events {
APP_START = 'appStart',
LOGIN = 'login',
LOGOUT = 'logout',
FILE_UPLOADED = 'fileUploaded',
LOCAL_FILES_UPDATED = 'localFilesUpdated',

View file

@ -58,8 +58,6 @@ class MLWorkManager {
logQueueStats(this.liveSyncQueue, 'livesync');
this.liveSyncQueue.on('idle', this.debouncedLiveSyncIdle, this);
// eventBus.on(Events.APP_START, this.appStartHandler, this);
// eventBus.on(Events.LOGIN, this.startSyncJob, this);
// eslint-disable-next-line @typescript-eslint/unbound-method
eventBus.on(Events.FILE_UPLOADED, this.fileUploadedHandler, this);
eventBus.on(
@ -75,8 +73,6 @@ class MLWorkManager {
this.liveSyncQueue.removeAllListeners();
// eventBus.removeListener(Events.APP_START, this.appStartHandler, this);
// eventBus.removeListener(Events.LOGIN, this.startSyncJob, this);
eventBus.removeListener(
Events.FILE_UPLOADED,
// eslint-disable-next-line @typescript-eslint/unbound-method