Skip to content

Commit

Permalink
Clear browser tabs when cleaning history (#3851)
Browse files Browse the repository at this point in the history
* Clear browser tabs when cleaning history

* Limit history to just 50

Co-authored-by: Curtis David <[email protected]>
  • Loading branch information
andrepimenta and cortisiko authored Mar 9, 2022
1 parent 80302c4 commit 3507c90
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/actions/browser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export function addToHistory({ url, name }) {
export function clearHistory() {
return {
type: 'CLEAR_BROWSER_HISTORY',
id: Date.now(),
};
}

Expand Down
6 changes: 5 additions & 1 deletion app/reducers/browser/index.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import AppConstants from '../../core/AppConstants';

const initialState = {
history: [],
whitelist: [],
Expand All @@ -9,7 +11,7 @@ const browserReducer = (state = initialState, action) => {
case 'ADD_TO_BROWSER_HISTORY':
return {
...state,
history: [...state.history, { url: action.url, name: action.name }],
history: [...state.history, { url: action.url, name: action.name }].slice(0, 50),
};
case 'ADD_TO_BROWSER_WHITELIST':
return {
Expand All @@ -20,6 +22,8 @@ const browserReducer = (state = initialState, action) => {
return {
...state,
history: [],
tabs: [{ url: AppConstants.HOMEPAGE_URL, id: action.id }],
activeTab: action.id,
};
case 'CLOSE_ALL_TABS':
return {
Expand Down

0 comments on commit 3507c90

Please sign in to comment.