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

Commit

Permalink
update activeFrameKey when the active tab changes
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver committed May 11, 2017
1 parent 12199f9 commit 4211ee5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 21 deletions.
7 changes: 0 additions & 7 deletions js/components/frame.js
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,6 @@ class Frame extends React.Component {
}

onPropsChanged (prevProps = {}) {
if (this.props.isTabActive && !prevProps.isTabActive) {
windowActions.activeFrameChanged(this.frame)
}
if (this.props.tabIndex !== prevProps.tabIndex) {
this.webview.setTabIndex(this.props.tabIndex)
}
Expand All @@ -218,9 +215,6 @@ class Frame extends React.Component {
}

componentDidMount () {
if (this.props.isTabActive) {
windowActions.activeFrameChanged(this.frame)
}
this.updateWebview(this.onPropsChanged)
if (this.props.activeShortcut) {
this.handleShortcut()
Expand Down Expand Up @@ -954,7 +948,6 @@ class Frame extends React.Component {
props.isFullScreen = frame.get('isFullScreen')
props.isPreview = frame.get('key') === currentWindow.get('previewFrameKey')
props.isActive = frameStateUtil.isFrameKeyActive(currentWindow, frame.get('key'))
props.isTabActive = tab ? tabState.isActive(state, tabId) : false
props.showFullScreenWarning = frame.get('showFullScreenWarning')
props.location = frame.get('location')
props.hrefPreview = frame.get('hrefPreview')
Expand Down
1 change: 0 additions & 1 deletion js/constants/windowConstants.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ const mapValuesByKeys = require('../lib/functional').mapValuesByKeys

const _ = null
const windowConstants = {
WINDOW_ACTIVE_FRAME_CHANGED: _,
WINDOW_SET_NAVBAR_INPUT: _,
WINDOW_CLOSE_FRAME: _,
WINDOW_CLOSE_FRAMES: _,
Expand Down
23 changes: 10 additions & 13 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,16 @@ const tabDataChanged = (state, action) => {
if (frameProps) {
state = state.mergeIn(['frames', frameStateUtil.getFramePropsIndex(frameStateUtil.getFrames(state), frameProps)], newProps)
state = state.mergeIn(['tabs', frameStateUtil.getFramePropsIndex(frameStateUtil.getFrames(state), frameProps)], newProps)
if (tab.get('active') === true && tab.get('windowId') === getCurrentWindowId()) {
state = state.merge({
activeFrameKey: frameProps.get('key'),
previewFrameKey: null
})
state = state.mergeIn(['frames', frameStateUtil.getFramePropsIndex(frameStateUtil.getFrames(state), action.frameProps)], {
lastAccessedTime: new Date().getTime() })
state = state.deleteIn(['ui', 'tabs', 'previewTabPageIndex'])
state = updateTabPageIndex(state, frameProps)
}
}
})
return state
Expand Down Expand Up @@ -381,19 +391,6 @@ const doAction = (action) => {
case windowConstants.WINDOW_CLEAR_CLOSED_FRAMES:
windowState = windowState.set('closedFrames', new Immutable.List())
break
case windowConstants.WINDOW_ACTIVE_FRAME_CHANGED:
if (!action.frameProps) {
break
}
windowState = windowState.merge({
activeFrameKey: action.frameProps.get('key'),
previewFrameKey: null
})
windowState = windowState.mergeIn(['frames', frameStateUtil.getFramePropsIndex(frameStateUtil.getFrames(windowState), action.frameProps)], {
lastAccessedTime: new Date().getTime() })
windowState = windowState.deleteIn(['ui', 'tabs', 'previewTabPageIndex'])
windowState = updateTabPageIndex(windowState, action.frameProps)
break
case windowConstants.WINDOW_SET_PREVIEW_FRAME:
windowState = windowState.merge({
previewFrameKey: action.frameProps && action.frameProps.get('key') !== windowState.get('activeFrameKey')
Expand Down

1 comment on commit 4211ee5

@bsclifton
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.