Skip to content
This repository has been archived by the owner on Dec 11, 2019. It is now read-only.

Commit

Permalink
tabs: only replace permanent contents
Browse files Browse the repository at this point in the history
  • Loading branch information
petemill committed Feb 22, 2018
1 parent 7d2fc77 commit 2d576e5
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions app/browser/tabs.js
Original file line number Diff line number Diff line change
Expand Up @@ -620,10 +620,17 @@ const api = {
})

tab.on('tab-replaced-at', (e, windowId, tabIndex, newContents) => {
console.log(`tab ${tab.getId()} changed to`, {newTabId: newContents.getId(), tabIndex})
const isPlaceholder = newContents.isPlaceholder()
const newTabId = newContents.getId()
if (isPlaceholder) {
if (shouldDebugTabEvents) {
console.log(`Tab [${tabId}] got a new placeholder (${newTabId}), not updating state.`)
}
return
}
// new contents is permanent replacement, e.g. tab has been discarded
if (shouldDebugTabEvents) {
console.log(`Tab [${tabId}] changed to tabId ${newTabId}. Updating state references...`)
console.log(`Tab [${tabId}] permanently changed to tabId ${newTabId}. Updating state references...`)
}
// update state
appActions.tabReplaced(tabId, getTabValue(newTabId), getTabValue(tabId).get('windowId'))
Expand Down

0 comments on commit 2d576e5

Please sign in to comment.