Skip to content

Commit

Permalink
remove no longer needed redux-multi dependency/usage
Browse files Browse the repository at this point in the history
  • Loading branch information
nerrad committed Mar 21, 2019
1 parent 80999cd commit 52af9b3
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 12 deletions.
1 change: 0 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@
"lodash": "^4.17.11",
"memize": "^1.0.5",
"react-autosize-textarea": "^3.0.2",
"redux-multi": "^0.1.12",
"redux-optimist": "^1.0.0",
"refx": "^3.0.0",
"rememo": "^3.0.0",
Expand Down
12 changes: 2 additions & 10 deletions packages/editor/src/store/middlewares.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
* External dependencies
*/
import refx from 'refx';
import multi from 'redux-multi';
import { flowRight } from 'lodash';

/**
* Internal dependencies
Expand All @@ -18,25 +16,19 @@ import effects from './effects';
* @return {Object} Update Store Object.
*/
function applyMiddlewares( store ) {
const middlewares = [
refx( effects ),
multi,
];

let enhancedDispatch = () => {
throw new Error(
'Dispatching while constructing your middleware is not allowed. ' +
'Other middleware would not be applied to this dispatch.'
);
};
let chain = [];

const middlewareAPI = {
getState: store.getState,
dispatch: ( ...args ) => enhancedDispatch( ...args ),
};
chain = middlewares.map( ( middleware ) => middleware( middlewareAPI ) );
enhancedDispatch = flowRight( ...chain )( store.dispatch );

enhancedDispatch = refx( effects )( middlewareAPI )( store.dispatch );

store.dispatch = enhancedDispatch;
return store;
Expand Down

0 comments on commit 52af9b3

Please sign in to comment.