From 60372192c7124e9c8605825f1a1ab1c21a4dde7c Mon Sep 17 00:00:00 2001 From: Gustaf Dalemar Date: Thu, 2 Jun 2016 13:20:08 +0200 Subject: [PATCH] Solved a memory leak on the server --- .../app/shared/flux/create-store.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/packages/roc-package-web-app-react/app/shared/flux/create-store.js b/packages/roc-package-web-app-react/app/shared/flux/create-store.js index 1b5ad9d..4f0b9af 100755 --- a/packages/roc-package-web-app-react/app/shared/flux/create-store.js +++ b/packages/roc-package-web-app-react/app/shared/flux/create-store.js @@ -19,9 +19,10 @@ export default function createReduxStore(reducers, ...middlewares) { return (callback) => (history, initialState) => { let finalCreateStore; + const normalMiddlewares = [].concat(middlewares); // Add the react-router-redux middleware - middlewares.push(routerMiddleware(history)); + normalMiddlewares.push(routerMiddleware(history)); if (__DEV__ && __WEB__) { const { persistState } = require('redux-devtools'); @@ -42,13 +43,13 @@ export default function createReduxStore(reducers, ...middlewares) { : require('../../client/dev-tools').default.instrument(); finalCreateStore = compose( - applyMiddleware(...middlewares, ...debugMiddlewares), + applyMiddleware(...normalMiddlewares, ...debugMiddlewares), devTools, persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)) )(createStore); } else { finalCreateStore = compose( - applyMiddleware(...middlewares) + applyMiddleware(...normalMiddlewares) )(createStore); }