mirror of
https://github.com/zen-browser/desktop.git
synced 2026-08-26 00:11:35 +00:00
gh-15088: Fixed syncing essentials with different containers (gh-15105)
This commit is contained in:
@@ -606,7 +606,9 @@ class nsZenWindowSync {
|
||||
if (isTab) {
|
||||
if (originalIsEssential !== targetIsEssential) {
|
||||
if (originalIsEssential) {
|
||||
gZenPinnedTabManager.addToEssentials(aTargetItem);
|
||||
gZenPinnedTabManager.addToEssentials(aTargetItem, {
|
||||
replicating: true,
|
||||
});
|
||||
} else {
|
||||
gZenPinnedTabManager.removeEssentials(
|
||||
aTargetItem,
|
||||
|
||||
@@ -498,7 +498,7 @@ class nsZenSpacesSyncApplier {
|
||||
tab._zenContentsVisible = true;
|
||||
this.#updateTabIdentity(win, tab, data);
|
||||
if (data.essential) {
|
||||
win.gZenPinnedTabManager.addToEssentials(tab);
|
||||
win.gZenPinnedTabManager.addToEssentials(tab, { replicating: true });
|
||||
} else {
|
||||
if (data.workspaceUuid) {
|
||||
tab.setAttribute("zen-workspace-id", data.workspaceUuid);
|
||||
@@ -658,7 +658,7 @@ class nsZenSpacesSyncApplier {
|
||||
|
||||
const isEssential = tab.hasAttribute("zen-essential");
|
||||
if (data.essential && !isEssential) {
|
||||
win.gZenPinnedTabManager.addToEssentials(tab);
|
||||
win.gZenPinnedTabManager.addToEssentials(tab, { replicating: true });
|
||||
return;
|
||||
}
|
||||
if (!data.essential && isEssential) {
|
||||
|
||||
@@ -503,7 +503,7 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature {
|
||||
}
|
||||
}
|
||||
|
||||
addToEssentials(tab) {
|
||||
addToEssentials(tab, { replicating = false } = {}) {
|
||||
// eslint-disable-next-line no-nested-ternary
|
||||
const tabs = tab
|
||||
? // if it's already an array, dont make it [tab]
|
||||
@@ -518,7 +518,11 @@ class nsZenPinnedTabManager extends nsZenDOMOperatedFeature {
|
||||
// eslint-disable-next-line no-shadow
|
||||
let tab = tabs[i];
|
||||
const section = gZenWorkspaces.getEssentialsSection(tab);
|
||||
if (!this.canEssentialBeAdded(tab)) {
|
||||
// canEssentialBeAdded gates user-initiated adds on the *active* space's
|
||||
// container. A replicated add mirrors a decision already made in another
|
||||
// window or on another device, always into the tab's own container
|
||||
// section.
|
||||
if (!replicating && !this.canEssentialBeAdded(tab)) {
|
||||
movedAll = false;
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user