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

Commit

Permalink
Fixes tab pages after setting change
Browse files Browse the repository at this point in the history
Resolves #7806

Auditors: @bsclifton @cezaraugusto

Test Plan:
- Open about:preferences#tabs
- Set the number of tabs per tab set to 6
- Open new tabs to create a new tab set, which has just 2 tabs
- Increase the number to 8
  • Loading branch information
NejcZdovc committed Jun 29, 2017
1 parent 4147821 commit f376e66
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 2 deletions.
4 changes: 2 additions & 2 deletions js/state/frameStateUtil.js
Original file line number Diff line number Diff line change
Expand Up @@ -451,9 +451,9 @@ 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) {
function updateTabPageIndex (state, frameProps, tabsPerPage = getSetting(settings.TABS_PER_PAGE)) {
frameProps = makeImmutable(frameProps)
const index = getFrameTabPageIndex(state, frameProps.get('key'))
const index = getFrameTabPageIndex(state, frameProps.get('key'), tabsPerPage)

if (index === -1) {
return state
Expand Down
15 changes: 15 additions & 0 deletions js/stores/windowStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -712,6 +724,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
Expand Down

0 comments on commit f376e66

Please sign in to comment.