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

Commit

Permalink
don’t call doAction inside doAction because it has the potential to l…
Browse files Browse the repository at this point in the history
…ose updates

fix #6791
  • Loading branch information
bridiver committed Jan 27, 2017
1 parent df3a212 commit 7968884
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,10 @@ const doAction = (action) => {
(action.frameProps.get('partitionNumber') || 0) === (frame.get('partitionNumber') || 0))
if (alreadyPinnedFrameProps && action.isPinned) {
action.actionType = windowConstants.WINDOW_CLOSE_FRAME
doAction(action)
setImmediate(() => { doAction(Object.assign({}, action)) })
action.actionType = windowConstants.WINDOW_SET_ACTIVE_FRAME
action.frameProps = alreadyPinnedFrameProps
doAction(action)
setImmediate(() => { doAction(Object.assign({}, action)) })
} else {
windowState = windowState.setIn(['frames', frameStateUtil.getFramePropsIndex(windowState.get('frames'), action.frameProps), 'pinnedLocation'],
action.isPinned ? location : undefined)
Expand Down Expand Up @@ -689,14 +689,14 @@ const doAction = (action) => {
break
case windowConstants.WINDOW_TOGGLE_MENUBAR_VISIBLE:
if (getSetting(settings.AUTO_HIDE_MENU)) {
doAction({actionType: windowConstants.WINDOW_SET_CONTEXT_MENU_DETAIL})
setImmediate(() => { doAction({actionType: windowConstants.WINDOW_SET_CONTEXT_MENU_DETAIL}) })
// Use value if provided; if not, toggle to opposite.
const newVisibleStatus = typeof action.isVisible === 'boolean'
? action.isVisible
: !windowState.getIn(['ui', 'menubar', 'isVisible'])
// Clear selection when menu is shown
if (newVisibleStatus) {
doAction({ actionType: windowConstants.WINDOW_SET_MENUBAR_SELECTED_INDEX, index: 0 })
setImmediate(() => { doAction({ actionType: windowConstants.WINDOW_SET_MENUBAR_SELECTED_INDEX, index: 0 }) })
}
windowState = windowState.setIn(['ui', 'menubar', 'isVisible'], newVisibleStatus)
}
Expand All @@ -708,16 +708,16 @@ const doAction = (action) => {
}
break
case windowConstants.WINDOW_RESET_MENU_STATE:
doAction({actionType: windowConstants.WINDOW_SET_POPUP_WINDOW_DETAIL})
doAction({actionType: windowConstants.WINDOW_HIDE_BOOKMARK_HANGER})
setImmediate(() => { doAction({actionType: windowConstants.WINDOW_SET_POPUP_WINDOW_DETAIL}) })
setImmediate(() => { doAction({actionType: windowConstants.WINDOW_HIDE_BOOKMARK_HANGER}) })
if (getSetting(settings.AUTO_HIDE_MENU)) {
doAction({actionType: windowConstants.WINDOW_TOGGLE_MENUBAR_VISIBLE, isVisible: false})
setImmediate(() => { doAction({actionType: windowConstants.WINDOW_TOGGLE_MENUBAR_VISIBLE, isVisible: false}) })
} else {
doAction({actionType: windowConstants.WINDOW_SET_CONTEXT_MENU_DETAIL})
setImmediate(() => { doAction({actionType: windowConstants.WINDOW_SET_CONTEXT_MENU_DETAIL}) })
}
doAction({actionType: windowConstants.WINDOW_SET_MENUBAR_SELECTED_INDEX})
doAction({actionType: windowConstants.WINDOW_SET_CONTEXT_MENU_SELECTED_INDEX})
doAction({actionType: windowConstants.WINDOW_SET_BOOKMARKS_TOOLBAR_SELECTED_FOLDER_ID})
setImmediate(() => { doAction({actionType: windowConstants.WINDOW_SET_MENUBAR_SELECTED_INDEX}) })
setImmediate(() => { doAction({actionType: windowConstants.WINDOW_SET_CONTEXT_MENU_SELECTED_INDEX}) })
setImmediate(() => { doAction({actionType: windowConstants.WINDOW_SET_BOOKMARKS_TOOLBAR_SELECTED_FOLDER_ID}) })
break
case windowConstants.WINDOW_SET_MENUBAR_SELECTED_INDEX:
windowState = windowState.setIn(['ui', 'menubar', 'selectedIndex'], action.index)
Expand Down

0 comments on commit 7968884

Please sign in to comment.