feat(workspaces): Refresh workspace strip after sync completion

This commit adds an observer for the `weave:engine:sync:finish` event and clears the workspace cache when the workspace sync is complete. This ensures that the workspace strip is updated with the latest data after a sync.
This commit is contained in:
Kristijan Ribarić 2024-10-04 14:04:24 +02:00
parent 187dece11c
commit 4a54adea9a

View file

@ -22,6 +22,20 @@ var ZenWorkspaces = new (class extends ZenMultiWindowFeature {
Weave.Service.engineManager.register(ZenWorkspacesEngine);
await this.initializeWorkspaces();
console.info('ZenWorkspaces: ZenWorkspaces initialized');
// Add observer for sync completion
Services.obs.addObserver(this, "weave:engine:sync:finish");
}
observe(subject, topic, data) {
if (topic === "weave:engine:sync:finish" && data === "workspaces") {
this._workspaceCache = null; // Clear cache to fetch fresh data
this.updateWorkspaceStrip();
}
}
updateWorkspaceStrip() {
this._propagateWorkspaceData().catch(console.error);
}
get shouldHaveWorkspaces() {