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

Commit

Permalink
Fixes #2913: Closing an inactive tab should not change the active tab
Browse files Browse the repository at this point in the history
  • Loading branch information
Willy Bruns committed Aug 3, 2016
1 parent c3f9fa0 commit 1b4ca20
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions js/actions/windowActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const siteTags = require('../constants/siteTags')
const siteUtil = require('../state/siteUtil')
const UrlUtil = require('../lib/urlutil')
const currentWindow = require('../../app/renderer/currentWindow')
const windowStore = require('../stores/windowStore')

function dispatch (action) {
AppDispatcher.dispatch(action)
Expand Down Expand Up @@ -335,7 +336,11 @@ const windowActions = {
return
}

if (!forceClosePinned) {
const frameKey = frameProps ? frameProps.get('key') : null
const activeFrameKey = windowStore.getState().get('activeFrameKey')
const isActiveFrame = frameKey === activeFrameKey

if (!forceClosePinned && isActiveFrame) {
// Go to next frame if the user tries to close a pinned tab
ipc.emit(messages.SHORTCUT_NEXT_TAB)
return
Expand Down Expand Up @@ -677,7 +682,7 @@ const windowActions = {
* @param {Object} frameToSkip - Properties of the frame to keep audio
*/
muteAllAudioExcept: function (frameToSkip) {
let framePropsList = require('../stores/windowStore').getState().get('frames')
let framePropsList = windowStore.getState().get('frames')

framePropsList.forEach((frameProps) => {
if (frameProps.get('key') !== frameToSkip.get('key') && frameProps.get('audioPlaybackActive') && !frameProps.get('audioMuted')) {
Expand Down

0 comments on commit 1b4ca20

Please sign in to comment.