diff --git a/appcontainer/AppContainerModel.ts b/appcontainer/AppContainerModel.ts index d2a5a214a..6ad6e0338 100644 --- a/appcontainer/AppContainerModel.ts +++ b/appcontainer/AppContainerModel.ts @@ -232,9 +232,14 @@ export class AppContainerModel extends HoistModel { } // Complete initialization process - await installServicesAsync([ConfigService, LocalStorageService, SessionStorageService]); + await installServicesAsync([LocalStorageService, SessionStorageService]); + await installServicesAsync([ + EnvironmentService, + ConfigService, + PrefService, + JsonBlobService + ]); await installServicesAsync(TrackService); - await installServicesAsync([EnvironmentService, PrefService, JsonBlobService]); await installServicesAsync([ AlertBannerService, diff --git a/core/ExceptionHandler.ts b/core/ExceptionHandler.ts index a7e0895fd..9e0494334 100644 --- a/core/ExceptionHandler.ts +++ b/core/ExceptionHandler.ts @@ -183,6 +183,9 @@ export class ExceptionHandler { * @returns true if message was successfully sent to server. */ async logOnServerAsync(options: ExceptionHandlerLoggingOptions): Promise { + // Simply can't log on server if this happened too early in life cycle. + if (!XH.trackService) return false; + const {exception, userAlerted, userMessage} = options; try { const username = XH.getUsername(); diff --git a/core/HoistAuthModel.ts b/core/HoistAuthModel.ts index db1e026ea..408b28433 100644 --- a/core/HoistAuthModel.ts +++ b/core/HoistAuthModel.ts @@ -33,7 +33,7 @@ export class HoistAuthModel extends HoistModel { * to the server. * * The default implementation of this method simply checks the auth status on the server, which - * may be appropriate for fully SSO (e.g. NTLM) based solutions. Override to consult or + * may be appropriate for fully SSO based solutions. Override to consult or * initialize third-party client resources such as OAuth. * * @returns true if the user has an authenticated session with the server, false if not. diff --git a/svc/PrefService.ts b/svc/PrefService.ts index 58aeccac9..1d898b617 100644 --- a/svc/PrefService.ts +++ b/svc/PrefService.ts @@ -7,7 +7,7 @@ import {HoistService, XH} from '@xh/hoist/core'; import {SECONDS} from '@xh/hoist/utils/datetime'; import {debounced, deepFreeze, throwIf} from '@xh/hoist/utils/js'; -import {cloneDeep, forEach, isEmpty, isEqual, size} from 'lodash'; +import {cloneDeep, forEach, isEmpty, isEqual} from 'lodash'; /** * Service to read and set user-specific preference values. @@ -33,7 +33,6 @@ export class PrefService extends HoistService { override async initAsync() { window.addEventListener('beforeunload', () => this.pushPendingAsync()); - await this.migrateLocalPrefsAsync(); return this.loadPrefsAsync(); } @@ -151,31 +150,6 @@ export class PrefService extends HoistService { this._data = data; } - private async migrateLocalPrefsAsync() { - try { - const key = 'localPrefs', - updates = XH.localStorageService.get(key, {}), - updateCount = size(updates); - if (updateCount) { - await XH.fetchJson({ - url: 'xh/migrateLocalPrefs', - timeout: 5 * SECONDS, - params: { - clientUsername: XH.getUsername(), - updates: JSON.stringify(updates) - }, - track: { - message: `Migrated ${updateCount} preferences`, - data: updates - } - }); - XH.localStorageService.remove(key); - } - } catch (e) { - XH.handleException(e, {showAlert: false}); - } - } - private validateBeforeSet(key, value) { const pref = this._data[key]; throwIf(!pref, `Cannot set preference ${key}: not found`);