refactor: Remove redundant tab refresh during initialization and streamline workspace startup process

This commit is contained in:
mr. M
2024-11-08 20:07:02 +01:00
parent d2746689f9
commit d7a48bd855
4 changed files with 12 additions and 5 deletions

View File

@@ -49,7 +49,6 @@
async initTabs() {
await ZenPinnedTabsStorage.init();
await this._refreshPinnedTabs();
}
async _refreshPinnedTabs() {

View File

@@ -47,6 +47,8 @@ var ZenPinnedTabsStorage = {
await db.execute(`
CREATE INDEX IF NOT EXISTS idx_zen_pins_changes_uuid ON zen_pins_changes(uuid)
`);
await gZenPinnedTabManager._refreshPinnedTabs();
});
},

View File

@@ -34,10 +34,9 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
ChromeUtils.defineLazyGetter(this, 'tabContainer', () => document.getElementById('tabbrowser-tabs'));
this._activeWorkspace = Services.prefs.getStringPref('zen.workspaces.active', '');
await ZenWorkspacesStorage.init();
if (!Weave.Service.engineManager.get('workspaces')) {
Weave.Service.engineManager.register(ZenWorkspacesEngine);
await ZenWorkspacesStorage.migrateWorkspacesFromJSON();
}
}
async _delayedStartup() {
await this.initializeWorkspaces();
console.info('ZenWorkspaces: ZenWorkspaces initialized');

View File

@@ -58,6 +58,13 @@ var ZenWorkspacesStorage = {
await db.execute(`
CREATE INDEX IF NOT EXISTS idx_zen_workspaces_changes_uuid ON zen_workspaces_changes(uuid)
`);
if (!Weave.Service.engineManager.get('workspaces')) {
Weave.Service.engineManager.register(ZenWorkspacesEngine);
await ZenWorkspacesStorage.migrateWorkspacesFromJSON();
}
ZenWorkspaces._delayedStartup();
});
},