Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions appcontainer/AppContainerModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
3 changes: 3 additions & 0 deletions core/ExceptionHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,9 @@ export class ExceptionHandler {
* @returns true if message was successfully sent to server.
*/
async logOnServerAsync(options: ExceptionHandlerLoggingOptions): Promise<boolean> {
// 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();
Expand Down
2 changes: 1 addition & 1 deletion core/HoistAuthModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
28 changes: 1 addition & 27 deletions svc/PrefService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -33,7 +33,6 @@ export class PrefService extends HoistService {

override async initAsync() {
window.addEventListener('beforeunload', () => this.pushPendingAsync());
await this.migrateLocalPrefsAsync();
return this.loadPrefsAsync();
}

Expand Down Expand Up @@ -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`);
Expand Down
Loading