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

Commit

Permalink
When no frame index is provided for a new tab, insert at the end of t…
Browse files Browse the repository at this point in the history
…he frame list

Fix #14101
Whilst we do not display a tab until it has received tab-inserted-at and therefore has an index, we do switch the active Tab Page to the index of the new tab (if it is active), which would be the index of the tab page at tab index 0.

A better fix would be to not add the frame to the window state until tab-inserted-at has been received. This could also help performance, especially if batched.
  • Loading branch information
petemill committed May 11, 2018
1 parent e043144 commit 306adc8
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,9 @@ const newFrame = (state, frameOpts) => {
console.debug('newFrame', frameOpts)
}
// Ensure valid index
let insertionIndex = frameOpts.index != null
? frameOpts.index
: 0
let insertionIndex = frameOpts.index
const highestFrameIndex = (state.get('frames') || Immutable.List()).count()
if (insertionIndex === -1 || insertionIndex > highestFrameIndex) {
if (insertionIndex == null || insertionIndex === -1 || insertionIndex > highestFrameIndex) {
if (shouldLogDebug) {
console.debug(`newFrame: invalid insertionIndex of ${insertionIndex} so using max index of ${highestFrameIndex}`)
}
Expand Down

0 comments on commit 306adc8

Please sign in to comment.