From 7968884491619772df836d904de268401e30314c Mon Sep 17 00:00:00 2001 From: bridiver Date: Thu, 26 Jan 2017 20:36:47 -0700 Subject: [PATCH] =?UTF-8?q?don=E2=80=99t=20call=20doAction=20inside=20doAc?= =?UTF-8?q?tion=20because=20it=20has=20the=20potential=20to=20lose=20updat?= =?UTF-8?q?es=20fix=20https://github.com/brave/browser-laptop/issues/6791?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- js/stores/windowStore.js | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/js/stores/windowStore.js b/js/stores/windowStore.js index 99b3f97fcd9..faf0b2947ae 100644 --- a/js/stores/windowStore.js +++ b/js/stores/windowStore.js @@ -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) @@ -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) } @@ -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)