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

Commit

Permalink
handle circular dependencies in reducers - see #8428
Browse files Browse the repository at this point in the history
  • Loading branch information
bridiver authored and bsclifton committed Apr 21, 2017
1 parent f553a8c commit 8e63cc0
Showing 1 changed file with 16 additions and 15 deletions.
31 changes: 16 additions & 15 deletions js/stores/appStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,21 +345,7 @@ function handleChangeSettingAction (settingKey, settingValue) {
}
}

const reducers = [
require('../../app/browser/reducers/downloadsReducer'),
require('../../app/browser/reducers/flashReducer'),
// tabs, sites and windows reducers need to stay in that order
// until we have a better way to manage dependencies
require('../../app/browser/reducers/tabsReducer'),
require('../../app/browser/reducers/sitesReducer'),
require('../../app/browser/reducers/windowsReducer'),
require('../../app/browser/reducers/spellCheckReducer'),
require('../../app/browser/reducers/clipboardReducer'),
require('../../app/browser/reducers/passwordManagerReducer'),
require('../../app/browser/reducers/tabMessageBoxReducer'),
require('../../app/browser/reducers/dragDropReducer'),
require('../../app/browser/reducers/extensionsReducer')
]
let reducers = []

const applyReducers = (state, action) => reducers.reduce(
(appState, reducer) => {
Expand All @@ -373,6 +359,21 @@ const handleAppAction = (action) => {
const ledger = require('../../app/ledger')

if (action.actionType === appConstants.APP_SET_STATE) {
reducers = [
require('../../app/browser/reducers/downloadsReducer'),
require('../../app/browser/reducers/flashReducer'),
// tabs, sites and windows reducers need to stay in that order
// until we have a better way to manage dependencies
require('../../app/browser/reducers/tabsReducer'),
require('../../app/browser/reducers/sitesReducer'),
require('../../app/browser/reducers/windowsReducer'),
require('../../app/browser/reducers/spellCheckReducer'),
require('../../app/browser/reducers/clipboardReducer'),
require('../../app/browser/reducers/passwordManagerReducer'),
require('../../app/browser/reducers/tabMessageBoxReducer'),
require('../../app/browser/reducers/dragDropReducer'),
require('../../app/browser/reducers/extensionsReducer')
]
initialized = true
appState = action.appState
}
Expand Down

1 comment on commit 8e63cc0

@NejcZdovc
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

++

Please sign in to comment.