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

Commit

Permalink
Trigger tab preview based on frame key
Browse files Browse the repository at this point in the history
- Auditors: @bsclifton, @luixxiul
- Close: #7606
  • Loading branch information
cezaraugusto committed May 17, 2017
1 parent 6ec02d8 commit e1cab8d
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions app/renderer/reducers/frameReducer.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,15 @@ const frameReducer = (state, action, immutableAction) => {
state = state.setIn(['frames', index, 'lastAccessedTime'], new Date().getTime())
state = state.deleteIn(['ui', 'tabs', 'previewTabPageIndex'])
state = updateTabPageIndex(state, frame)
} else {
// preview the next frame index if updated tab
// is not active. This only wanted for tabs closed with
// mouse so only fired if hoverState is true
state = state.merge({
previewFrameKey: frame.get('hoverState')
? frameStateUtil.getFrameIndex(state, index)
: null
})
}
}
break
Expand Down Expand Up @@ -140,8 +149,11 @@ const frameReducer = (state, action, immutableAction) => {
state = closeFrame(state, action)

const frame = frameStateUtil.getActiveFrame(state)
const nextFrame = frameStateUtil.getNextFrame(state)
if (frame) {
appActions.tabActivateRequested(frame.get('tabId'))
// If a tab is closed then immediately preview the next frame
windowActions.setPreviewFrame(nextFrame.get('key'))
}
} else {
appActions.closeWindow(getCurrentWindowId())
Expand Down

0 comments on commit e1cab8d

Please sign in to comment.