forked from brave/browser-laptop
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moves bookmark text calculation into the state
Resolves brave#9517 Auditors: Test Plan:
Showing
27 changed files
with
1,458 additions
and
269 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/* This Source Code Form is subject to the terms of the Mozilla Public | ||
* License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
* You can obtain one at http://mozilla.org/MPL/2.0/. */ | ||
|
||
// Constants | ||
const appConstants = require('../../../js/constants/appConstants') | ||
|
||
// State | ||
const bookmarksState = require('../../common/state/bookmarksState') | ||
const bookmarkFoldersState = require('../../common/state/bookmarkFoldersState') | ||
|
||
// Util | ||
const {makeImmutable} = require('../../common/state/immutableUtil') | ||
const textCalcUtil = require('../../common/lib/textCalcUtil') | ||
|
||
const tabsReducer = (state, action, immutableAction) => { | ||
action = immutableAction || makeImmutable(action) | ||
switch (action.get('actionType')) { | ||
case appConstants.APP_SET_STATE: | ||
{ | ||
// update session for 0.21.x version | ||
const bookmarks = bookmarksState.getBookmarks(state) | ||
if (!bookmarks.first().has('width')) { | ||
textCalcUtil.calcTextList(bookmarks.toList()) | ||
} | ||
|
||
const bookmarkFolders = bookmarkFoldersState.getFolders(state) | ||
if (!bookmarkFolders.first().has('width')) { | ||
textCalcUtil.calcTextList(bookmarkFolders.toList()) | ||
} | ||
} | ||
break | ||
} | ||
return state | ||
} | ||
|
||
module.exports = tabsReducer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.