Skip to content

Commit 4af488b

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
fix: relaxed saveAll if no Internet connection
The previous logic has incorrectly bailed the save when there is no Internet connection. The corrected logic disallows saving files if there is no connection between the frontend and the backend. Ref: cff2c95 Closes #2079 Signed-off-by: Akos Kitta <[email protected]>
1 parent db0049d commit 4af488b

File tree

1 file changed

+5
-9
lines changed

1 file changed

+5
-9
lines changed

Diff for: arduino-ide-extension/src/browser/theia/core/application-shell.ts

+5-9
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,19 @@ import {
88
TabBar,
99
Widget,
1010
} from '@theia/core/lib/browser';
11-
import {
12-
ConnectionStatus,
13-
ConnectionStatusService,
14-
} from '@theia/core/lib/browser/connection-status-service';
1511
import { nls } from '@theia/core/lib/common/nls';
1612
import { MessageService } from '@theia/core/lib/common/message-service';
1713
import { inject, injectable } from '@theia/core/shared/inversify';
14+
import { ApplicationConnectionStatusContribution } from './connection-status-service';
1815
import { ToolbarAwareTabBar } from './tab-bars';
1916

2017
@injectable()
2118
export class ApplicationShell extends TheiaApplicationShell {
2219
@inject(MessageService)
2320
private readonly messageService: MessageService;
2421

25-
@inject(ConnectionStatusService)
26-
private readonly connectionStatusService: ConnectionStatusService;
22+
@inject(ApplicationConnectionStatusContribution)
23+
private readonly connectionStatusService: ApplicationConnectionStatusContribution;
2724

2825
override async addWidget(
2926
widget: Widget,
@@ -64,9 +61,8 @@ export class ApplicationShell extends TheiaApplicationShell {
6461
}
6562

6663
override async saveAll(options?: SaveOptions): Promise<void> {
67-
if (
68-
this.connectionStatusService.currentStatus === ConnectionStatus.OFFLINE
69-
) {
64+
// When there is no connection between the IDE2 frontend and backend.
65+
if (this.connectionStatusService.offlineStatus === 'backend') {
7066
this.messageService.error(
7167
nls.localize(
7268
'theia/core/couldNotSave',

0 commit comments

Comments
 (0)