diff --git a/src/zen/common/modules/ZenStartup.mjs b/src/zen/common/modules/ZenStartup.mjs index 93e549f56..307fa0dbf 100644 --- a/src/zen/common/modules/ZenStartup.mjs +++ b/src/zen/common/modules/ZenStartup.mjs @@ -100,7 +100,16 @@ class ZenStartup { delete this.promiseInitializedResolve; setTimeout(() => { - gZenWorkspaces._invalidateBookmarkContainers(); + // Wait for the natural PlacesToolbar rebuild before invalidating, so + // the two async rebuilds don't interleave and duplicate bookmarks. + // promiseRebuilt() returns undefined when no rebuild is in flight. + const rebuilt = + document + .getElementById("PlacesToolbar") + ?._placesView?.promiseRebuilt() ?? Promise.resolve(); + rebuilt + .catch(console.error) + .then(() => gZenWorkspaces._invalidateBookmarkContainers()); }); }); }