mirror of
https://github.com/bitwarden/browser
synced 2025-12-12 22:33:35 +00:00
[PM-6032] Run migrations in main process (#7795)
* Run Migrations in Desktop Main Process * Add `waitForMigrations` method * Add `InitOptions` * Fix Destructuring
This commit is contained in:
@@ -43,7 +43,7 @@ export class InitService {
|
||||
init() {
|
||||
return async () => {
|
||||
this.nativeMessagingService.init();
|
||||
await this.stateService.init();
|
||||
await this.stateService.init({ runMigrations: false }); // Desktop will run them in main process
|
||||
await this.environmentService.setUrlsFromStorage();
|
||||
// Workaround to ignore stateService.activeAccount until URLs are set
|
||||
// TODO: Remove this when implementing ticket PM-2637
|
||||
|
||||
@@ -16,7 +16,8 @@ import { DefaultGlobalStateProvider } from "@bitwarden/common/platform/state/imp
|
||||
import { DefaultSingleUserStateProvider } from "@bitwarden/common/platform/state/implementations/default-single-user-state.provider";
|
||||
import { DefaultStateProvider } from "@bitwarden/common/platform/state/implementations/default-state.provider";
|
||||
import { MemoryStorageService as MemoryStorageServiceForStateProviders } from "@bitwarden/common/platform/state/storage/memory-storage.service";
|
||||
/*/ eslint-enable import/no-restricted-paths */
|
||||
/* eslint-enable import/no-restricted-paths */
|
||||
import { migrate } from "@bitwarden/common/state-migrations";
|
||||
|
||||
import { MenuMain } from "./main/menu/menu.main";
|
||||
import { MessagingMain } from "./main/messaging.main";
|
||||
@@ -191,8 +192,10 @@ export class Main {
|
||||
|
||||
bootstrap() {
|
||||
this.desktopCredentialStorageListener.init();
|
||||
this.windowMain.init().then(
|
||||
// Run migrations first, then other things
|
||||
migrate(this.storageService, this.logService).then(
|
||||
async () => {
|
||||
await this.windowMain.init();
|
||||
const locale = await this.stateService.getLocale();
|
||||
await this.i18nService.init(locale != null ? locale : app.getLocale());
|
||||
this.messagingMain.init();
|
||||
|
||||
Reference in New Issue
Block a user