Skip to content

Commit

Permalink
Rename indexed dbs with positron prefix (#5035)
Browse files Browse the repository at this point in the history
- Addresses: #4864
- updates the prefixes for web IndexedDB databases and stores to use
`positron` instead of `vscode`
- we don't delete the existing stores that are prefixed with `vscode`

I've done some testing on a dev build of Server Web on Mac and a local
release build of Positron on Workbench on Ubuntu 24.

### QA Notes

- this change impacts Positron Web / Server Web only
- the data stores are working if:
- you're seeing the renamed databases and stores in Developer Tools >
Application > Storage > IndexedDB
- the layout state is being persisted when you close and reopen Positron
in the same browser; for example:
        1. Open up a folder in Positron Web / Server Web
        2. Command Prompt > View: Toggle Zen Mode
        3. Close the browser
4. Open up the same folder in the same browser in Positron Web / Server
Web
        5. You should still be in Zen Mode
  • Loading branch information
sharon-wang authored Oct 16, 2024
1 parent b17da0a commit 638de70
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/vs/workbench/browser/web.main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -459,11 +459,15 @@ export class BrowserMain extends Disposable {

// IndexedDB is used for logging and user data
let indexedDB: IndexedDB | undefined;
const userDataStore = 'vscode-userdata-store';
const logsStore = 'vscode-logs-store';
const handlesStore = 'vscode-filehandles-store';
// --- Start Positron ---
const userDataStore = 'positron-userdata-store';
const logsStore = 'positron-logs-store';
const handlesStore = 'positron-filehandles-store';
// --- End Positron ---
try {
indexedDB = await IndexedDB.create('vscode-web-db', 3, [userDataStore, logsStore, handlesStore]);
// --- Start Positron ---
indexedDB = await IndexedDB.create('positron-web-db', 3, [userDataStore, logsStore, handlesStore]);
// --- End Positron ---

// Close onWillShutdown
this.onWillShutdownDisposables.add(toDisposable(() => indexedDB?.close()));
Expand Down
4 changes: 3 additions & 1 deletion src/vs/workbench/services/storage/browser/storageService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,9 @@ export class IndexedDBStorageDatabase extends Disposable implements IIndexedDBSt
}
}

private static readonly STORAGE_DATABASE_PREFIX = 'vscode-web-state-db-';
// --- Start Positron ---
private static readonly STORAGE_DATABASE_PREFIX = 'positron-web-state-db-';
// --- End Positron ---
private static readonly STORAGE_OBJECT_STORE = 'ItemTable';

private readonly _onDidChangeItemsExternal = this._register(new Emitter<IStorageItemsChangeEvent>());
Expand Down

0 comments on commit 638de70

Please sign in to comment.