From 71c52373f81cace664047edd19d9d289f45a4dff Mon Sep 17 00:00:00 2001 From: Ricardo Cino Date: Thu, 7 Jul 2022 09:31:50 +0200 Subject: chore: Mobx & React-Router upgrade (#406) Co-authored-by: Vijay A --- src/stores/AppStore.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/stores/AppStore.ts') diff --git a/src/stores/AppStore.ts b/src/stores/AppStore.ts index 0ecfdb7c0..ed6d0e263 100644 --- a/src/stores/AppStore.ts +++ b/src/stores/AppStore.ts @@ -7,7 +7,7 @@ import { getCurrentWindow, process as remoteProcess, } from '@electron/remote'; -import { action, computed, observable } from 'mobx'; +import { action, computed, makeObservable, observable } from 'mobx'; import moment from 'moment'; import AutoLaunch from 'auto-launch'; import ms from 'ms'; @@ -105,6 +105,8 @@ export default class AppStore extends TypedStore { constructor(stores: Stores, api: ApiInterface, actions: Actions) { super(stores, api, actions); + makeObservable(this); + // Register action handlers this.actions.app.notify.listen(this._notify.bind(this)); this.actions.app.setBadge.listen(this._setBadge.bind(this)); @@ -510,7 +512,7 @@ export default class AppStore extends TypedStore { } _setLocale() { - if (this.stores.user.isLoggedIn && this.stores.user.data.locale) { + if (this.stores.user?.isLoggedIn && this.stores.user?.data.locale) { this.locale = this.stores.user.data.locale; } else if (!this.locale) { this.locale = this._getDefaultLocale(); -- cgit v1.2.3-54-g00ecf