Skip to content

Commit

Permalink
Fixed: Normalize panels-tabs relations without saved data too
Browse files Browse the repository at this point in the history
  • Loading branch information
mbnuqw committed Apr 13, 2021
1 parent 8063976 commit 72b8d59
Showing 1 changed file with 22 additions and 22 deletions.
44 changes: 22 additions & 22 deletions src/sidebar/actions/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,18 +83,18 @@ async function loadTabsFromGlobalStorage() {
idsMap[data.id] = tab.id

if (tab.url.startsWith(GROUP_URL)) this.actions.linkGroupWithPinnedTab(tab, tabs)
}

// Normalize panelId
let panel = this.state.panelsMap[tab.panelId]
if (!panel) {
if (tab.pinned) tab.panelId = DEFAULT_CTX_ID
else tab.panelId = lastPanel.id
} else {
if (!tab.pinned) {
// Check order of panels
if (panel.index < lastPanel.index) tab.panelId = lastPanel.id
else lastPanel = panel
}
// Normalize panelId
let panel = this.state.panelsMap[tab.panelId]
if (!panel) {
if (tab.pinned) tab.panelId = DEFAULT_CTX_ID
else tab.panelId = lastPanel.id
} else {
if (!tab.pinned) {
// Check order of panels
if (panel.index < lastPanel.index) tab.panelId = lastPanel.id
else lastPanel = panel
}
}

Expand Down Expand Up @@ -198,18 +198,18 @@ async function loadTabsFromSessionStorage() {
idsMap[data.id] = tab.id

if (tab.url.startsWith(GROUP_URL)) this.actions.linkGroupWithPinnedTab(tab, tabs)
}

// Normalize panelId
let panel = this.state.panelsMap[tab.panelId]
if (!panel) {
if (tab.pinned) tab.panelId = DEFAULT_CTX_ID
else tab.panelId = lastPanel.id
} else {
if (!tab.pinned) {
// Check order of panels
if (panel.index < lastPanel.index) tab.panelId = lastPanel.id
else lastPanel = panel
}
// Normalize panelId
let panel = this.state.panelsMap[tab.panelId]
if (!panel) {
if (tab.pinned) tab.panelId = DEFAULT_CTX_ID
else tab.panelId = lastPanel.id
} else {
if (!tab.pinned) {
// Check order of panels
if (panel.index < lastPanel.index) tab.panelId = lastPanel.id
else lastPanel = panel
}
}

Expand Down

0 comments on commit 72b8d59

Please sign in to comment.