Skip to content

Commit ce02e26

Browse files
Akos Kittakittaakos
Akos Kitta
authored andcommitted
fix: storage service injection
Store the board config data per sketch and not per IDE installation. The (Theia) default `StorageService` implementation is workspace-scoped when `@theia/workspace` is part of the final application. Closes #2240 Signed-off-by: Akos Kitta <[email protected]>
1 parent ed2d8ad commit ce02e26

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

Diff for: arduino-ide-extension/src/browser/boards/boards-data-store.ts

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { FrontendApplicationContribution } from '@theia/core/lib/browser/frontend-application';
2-
import { LocalStorageService } from '@theia/core/lib/browser/storage-service';
2+
import { StorageService } from '@theia/core/lib/browser/storage-service';
33
import { DisposableCollection } from '@theia/core/lib/common/disposable';
44
import { Emitter, Event } from '@theia/core/lib/common/event';
55
import { ILogger } from '@theia/core/lib/common/logger';
@@ -23,8 +23,11 @@ export class BoardsDataStore implements FrontendApplicationContribution {
2323
private readonly boardsService: BoardsService;
2424
@inject(NotificationCenter)
2525
private readonly notificationCenter: NotificationCenter;
26-
@inject(LocalStorageService)
27-
private readonly storageService: LocalStorageService;
26+
// When `@theia/workspace` is part of the application, the workspace-scoped storage service is the default implementation, and the `StorageService` symbol must be used for the injection.
27+
// https://github.com/eclipse-theia/theia/blob/ba3722b04ff91eb6a4af6a571c9e263c77cdd8b5/packages/workspace/src/browser/workspace-frontend-module.ts#L97-L98
28+
// In other words, store the data (such as the board configs) per sketch, not per IDE2 installation. https://github.com/arduino/arduino-ide/issues/2240
29+
@inject(StorageService)
30+
private readonly storageService: StorageService;
2831

2932
private readonly onChangedEmitter = new Emitter<string[]>();
3033
private readonly toDispose = new DisposableCollection(this.onChangedEmitter);

0 commit comments

Comments
 (0)