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

Commit

Permalink
Merge pull request #14102 from brave/fix/14101-tab-page-change-new-tab
Browse files Browse the repository at this point in the history
When no frame index is provided for a new tab, insert at the end of the frame list
  • Loading branch information
petemill authored May 12, 2018
2 parents 73886ff + 11854e6 commit ff065bb
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -118,11 +118,10 @@ 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) {
const insertionIndexIsInvalid = (insertionIndex == null || insertionIndex < 0 || insertionIndex > highestFrameIndex)
if (insertionIndexIsInvalid) {
if (shouldLogDebug) {
console.debug(`newFrame: invalid insertionIndex of ${insertionIndex} so using max index of ${highestFrameIndex}`)
}
Expand Down

0 comments on commit ff065bb

Please sign in to comment.