Skip to content

Commit

Permalink
Don't veto shutdown in web mode (#6091)
Browse files Browse the repository at this point in the history
This change fixes an issue in which Positron prompts to save changes
whenever you try to navigate away from the page in web mode.

It turns out that in web mode (specifically), async shutdown operations
aren't supported, and trying to use them results in this behavior. The
fix is simply to not clear the session list in web mode, which should be
fine as the reason we need to do this has to do with multiple Electron
windows.

Addresses #6062. 

### QA Notes

As noted in the issue it's very easy to hit this, so should be easy to
verify as well!
  • Loading branch information
jmcphers authored Jan 23, 2025
1 parent 797298e commit 843bee4
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import { IWorkspaceTrustManagementService } from '../../../../platform/workspace
import { URI } from '../../../../base/common/uri.js';
import { IWorkspaceContextService, WorkbenchState } from '../../../../platform/workspace/common/workspace.js';
import { IPositronNewProjectService } from '../../positronNewProject/common/positronNewProject.js';
import { isWeb } from '../../../../base/common/platform.js';

interface ILanguageRuntimeProviderMetadata {
languageId: string;
Expand Down Expand Up @@ -320,7 +321,14 @@ export class RuntimeStartupService extends Disposable implements IRuntimeStartup
// storage, but it is possible that this workspace will be
// re-opened without an interleaving quit (e.g. if multiple
// Positron windows are open).
e.veto(this.clearWorkspaceSessions(), 'positron.runtimeStartup.clearWorkspaceSessions');
//
// We don't do this in web mode because async shutdown
// operations aren't supported on the web, and if used will
// trigger a browser warning when the user attempts to navigate
// away.
if (!isWeb) {
e.veto(this.clearWorkspaceSessions(), 'positron.runtimeStartup.clearWorkspaceSessions');
}
}
}));
}
Expand Down

0 comments on commit 843bee4

Please sign in to comment.