fix: Fixed various issues with storing folders at startup, b=no-bug, c=tabs, welcome

This commit is contained in:
Mr. M
2025-08-28 16:08:54 +02:00
parent 31def1147a
commit 95b137ac13
2 changed files with 21 additions and 7 deletions

View File

@@ -190,6 +190,7 @@
async #initializePinnedTabs(init = false) {
const pins = this._pinsCache;
if (!pins?.length || !init) {
this.#hasInitializedPins = true;
return;
}
@@ -372,12 +373,12 @@
}
}
gBrowser._updateTabBarForPinnedTabs();
gZenUIManager.updateTabsToolbar();
setTimeout(() => {
this.#hasInitializedPins = true;
}, 0);
gBrowser._updateTabBarForPinnedTabs();
gZenUIManager.updateTabsToolbar();
}
_onPinnedTabEvent(action, event) {
@@ -445,6 +446,12 @@
group._pPos
);
group.setAttribute('zen-pin-id', id);
for (const tab of group.tabs) {
if (tab.pinned && tab.hasAttribute('zen-pin-id')) {
const tabPinId = tab.getAttribute('zen-pin-id');
ZenPinnedTabsStorage.addTabToGroup(tabPinId, id, /* position */ tab._pPos);
}
}
await this.refreshPinnedTabs();
}
@@ -726,6 +733,10 @@
const existingPin = this._pinsCache.find((p) => p.uuid === pin.uuid);
if (existingPin) {
Object.assign(existingPin, pin);
} else {
// We shouldn't need it, but just in case there's
// a race condition while making new pinned tabs.
this._pinsCache.push(pin);
}
await ZenPinnedTabsStorage.savePin(pin, notifyObservers);
}

View File

@@ -137,7 +137,7 @@
document.getElementById('zen-welcome-pages').style.display = 'flex';
document.getElementById('zen-welcome-start').remove();
window.maximize();
animate('#zen-welcome-pages', { opacity: [0, 1] }, { delay: 0.2, duration: 0.2 });
animate('#zen-welcome-pages', { opacity: [0, 1] }, { delay: 0.2, duration: 0.1 });
}
async fadeInTitles(page) {
@@ -238,7 +238,7 @@
delay: getMotion().stagger(0.05, { startDelay: 0.3 }),
type: 'spring',
bounce: 0,
duration: 0.2,
duration: 0.1,
}
);
}
@@ -271,7 +271,7 @@
await animate('#zen-welcome-page-content', { x: [0, '100%'] }, { bounce: 0 });
document.getElementById('zen-welcome-page-content').remove();
await this.animHeart();
this._pinRemainingTabs();
await this.#pinRemainingTabs();
await animate('#zen-welcome-pages', { opacity: [1, 0] });
document.getElementById('zen-welcome').remove();
document.documentElement.removeAttribute('zen-welcome-stage');
@@ -288,10 +288,13 @@
gZenUIManager.showToast('zen-welcome-finished');
}
_pinRemainingTabs() {
async #pinRemainingTabs() {
for (const tab of _tabsToPin) {
tab.setAttribute('zen-workspace-id', gZenWorkspaces.activeWorkspace);
gBrowser.pinTab(tab);
await new Promise((resolve) => {
tab.addEventListener('ZenPinnedTabCreated', resolve, { once: true });
});
}
for (const tab of _tabsToPinEssentials) {
tab.removeAttribute('pending'); // Make it appear loaded