feat: Add workspace ordering and changes tracking

This commit introduces workspace ordering and a new mechanism for tracking changes to workspaces.

**Changes:**

- **Workspace Ordering:** Workspaces can now be ordered using a `position` field. This allows for user-defined ordering of workspaces, improving usability.
- **Changes Tracking:** A new `zen_workspaces_changes` table is added to track changes to workspaces. This allows for more efficient sync operations and improved error handling.

**Benefits:**

- **Improved Workspace Management:** Users can now customize the order of their workspaces.
- **More Efficient Sync:** Changes tracking enables faster and more accurate synchronization of workspaces across devices.
- **Enhanced Error Handling:** Changes tracking helps to identify and resolve conflicts during sync.

**Notes:**

- This change requires deleting the zen_workspaces table in places db
This commit is contained in:
Kristijan Ribarić 2024-10-05 19:20:19 +02:00
parent 1c7bc5c501
commit 0d161326ef
3 changed files with 535 additions and 211 deletions

View file

@ -84,6 +84,8 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
// Set the active workspace ID to the first one if active workspace doesn't exist
Services.prefs.setStringPref('zen.workspaces.active', this._workspaceCache.workspaces[0]?.uuid);
}
// sort by position
this._workspaceCache.workspaces.sort((a, b) => (a.position ?? Infinity) - (b.position ?? Infinity));
}
return this._workspaceCache;
}