mirror of
https://github.com/zen-browser/components.git
synced 2025-07-08 14:10:00 +02:00
Fix: Ensure tab context works after moving a tab to different workspace.
Calling to _workspaces() always gets the fresh data from db, moved caching responsibility to db for getWorkspaces().
This commit is contained in:
parent
7b518c9243
commit
24d7af3da0
2 changed files with 14 additions and 15 deletions
|
@ -72,7 +72,6 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
}
|
}
|
||||||
|
|
||||||
async _workspaces() {
|
async _workspaces() {
|
||||||
if (!this._workspaceCache) {
|
|
||||||
this._workspaceCache = { workspaces: await ZenWorkspacesStorage.getWorkspaces() };
|
this._workspaceCache = { workspaces: await ZenWorkspacesStorage.getWorkspaces() };
|
||||||
// Get the active workspace ID from preferences
|
// Get the active workspace ID from preferences
|
||||||
const activeWorkspaceId = Services.prefs.getStringPref('zen.workspaces.active', '');
|
const activeWorkspaceId = Services.prefs.getStringPref('zen.workspaces.active', '');
|
||||||
|
@ -89,7 +88,7 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
|
||||||
}
|
}
|
||||||
// sort by position
|
// sort by position
|
||||||
this._workspaceCache.workspaces.sort((a, b) => (a.position ?? Infinity) - (b.position ?? Infinity));
|
this._workspaceCache.workspaces.sort((a, b) => (a.position ?? Infinity) - (b.position ?? Infinity));
|
||||||
}
|
|
||||||
return this._workspaceCache;
|
return this._workspaceCache;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -150,7 +150,7 @@ var ZenWorkspacesStorage = {
|
||||||
|
|
||||||
async getWorkspaces() {
|
async getWorkspaces() {
|
||||||
const db = await PlacesUtils.promiseDBConnection();
|
const db = await PlacesUtils.promiseDBConnection();
|
||||||
const rows = await db.execute(`
|
const rows = await db.executeCached(`
|
||||||
SELECT * FROM zen_workspaces ORDER BY created_at ASC
|
SELECT * FROM zen_workspaces ORDER BY created_at ASC
|
||||||
`);
|
`);
|
||||||
return rows.map((row) => ({
|
return rows.map((row) => ({
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue