Skip to content

Commit

Permalink
Don't register onWillShutdown operation in web (#175075)
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceerhl committed Feb 22, 2023
1 parent ed2add3 commit 6efb4de
Showing 1 changed file with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,11 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
this.shouldShowViewsContext = EDIT_SESSIONS_SHOW_VIEW.bindTo(this.contextKeyService);

this._register(this.fileService.registerProvider(EditSessionsFileSystemProvider.SCHEMA, new EditSessionsFileSystemProvider(this.editSessionsStorageService)));
this.lifecycleService.onWillShutdown((e) => e.join(this.autoStoreEditSession(), { id: 'autoStoreWorkingChanges', label: localize('autoStoreWorkingChanges', 'Storing current working changes...') }));
this.lifecycleService.onWillShutdown((e) => {
if (this.configurationService.getValue('workbench.experimental.cloudChanges.autoStore') === 'onShutdown' && !isWeb) {
e.join(this.autoStoreEditSession(), { id: 'autoStoreWorkingChanges', label: localize('autoStoreWorkingChanges', 'Storing current working changes...') });
}
});
this._register(this.editSessionsStorageService.onDidSignIn(() => this.updateAccountsMenuBadge()));
this._register(this.editSessionsStorageService.onDidSignOut(() => this.updateAccountsMenuBadge()));
}
Expand Down Expand Up @@ -223,17 +227,15 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo
}

private async autoStoreEditSession() {
if (this.configurationService.getValue('workbench.experimental.cloudChanges.autoStore') === 'onShutdown' && !isWeb) {
const cancellationTokenSource = new CancellationTokenSource();
await this.progressService.withProgress({
location: ProgressLocation.Window,
type: 'syncing',
title: localize('store working changes', 'Storing working changes...')
}, async () => this.storeEditSession(false, cancellationTokenSource.token), () => {
cancellationTokenSource.cancel();
cancellationTokenSource.dispose();
});
}
const cancellationTokenSource = new CancellationTokenSource();
await this.progressService.withProgress({
location: ProgressLocation.Window,
type: 'syncing',
title: localize('store working changes', 'Storing working changes...')
}, async () => this.storeEditSession(false, cancellationTokenSource.token), () => {
cancellationTokenSource.cancel();
cancellationTokenSource.dispose();
});
}

private registerViews() {
Expand Down

0 comments on commit 6efb4de

Please sign in to comment.