diff --git a/js/state/frameStateUtil.js b/js/state/frameStateUtil.js index 04bdc92f5bb..1b847ad6c33 100644 --- a/js/state/frameStateUtil.js +++ b/js/state/frameStateUtil.js @@ -450,8 +450,8 @@ function isPinned (state, frameKey) { * Updates the tab page index to the specified frameProps * @param frameProps Any frame belonging to the page */ -function updateTabPageIndex (state, frameProps) { - const index = getFrameTabPageIndex(state, frameProps, getSetting(settings.TABS_PER_PAGE)) +function updateTabPageIndex (state, frameProps, tabsPerPage = getSetting(settings.TABS_PER_PAGE)) { + const index = getFrameTabPageIndex(state, frameProps, tabsPerPage) if (index === -1) { return state diff --git a/js/stores/windowStore.js b/js/stores/windowStore.js index f90d6ebd3f2..e78fbf027e3 100644 --- a/js/stores/windowStore.js +++ b/js/stores/windowStore.js @@ -229,6 +229,18 @@ const frameGuestInstanceIdChanged = (state, action) => { }) } +function handleChangeSettingAction (state, settingKey, settingValue) { + switch (settingKey) { + case settings.TABS_PER_PAGE: + const activeFrame = frameStateUtil.getActiveFrame(state) + state = frameStateUtil.updateTabPageIndex(state, activeFrame, settingValue) + break + default: + } + + return state +} + const windowStore = new WindowStore() const emitChanges = debounce(windowStore.emitChanges.bind(windowStore), 5) @@ -719,6 +731,9 @@ const doAction = (action) => { } windowState = newFrame(windowState, action.frameOpts) break + case appConstants.APP_CHANGE_SETTING: + windowState = handleChangeSettingAction(windowState, action.key, action.value) + break case windowConstants.WINDOW_FRAME_MOUSE_ENTER: windowState = windowState.setIn(['ui', 'mouseInFrame'], true) break