Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
// Sync dispatched route actions to the history
const sagaMiddleware = createSagaMiddleware();
const middleware = [sagaMiddleware];
let finalCreateStore;
if (__DEVELOPMENT__ && __CLIENT__ && __DEVTOOLS__) {
// const reactotronEnhancer = createReactotronEnhancer(Reactotron)
const { persistState } = require('redux-devtools');
const DevTools = require('../core/DevTools');
finalCreateStore = compose(
// reactotronEnhancer,
applyMiddleware(...middleware),
window.devToolsExtension
? window.devToolsExtension()
: DevTools.instrument(),
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
)(_createStore);
} else {
finalCreateStore = applyMiddleware(...middleware)(_createStore);
}
const reducer = require('./reducers/index');
const store = finalCreateStore(reducer, Immutable.fromJS(data));
// Object.values(sagas).forEach(saga => sagaMiddleware.run(user));
sagaMiddleware
.run(rootSaga)
.done.catch(err => console.log('[SAGA-ERROR]', err));
if (__DEVELOPMENT__ && module.hot) {
module.hot.accept('./reducers/index', () => {
store.replaceReducer(require('./reducers/index'));
// top entry
import App from '../component/App';
import Admin from '../component/Admin';
// Sync dispatched route actions to the history
const reduxRouterMiddleware = syncHistory(browserHistory);
const createStoreWithMiddleware = applyMiddleware(reduxRouterMiddleware)(createStore);
const enhancer = compose(
applyMiddleware(
thunkMiddleware,
loggerMiddleware
),
DevTools.instrument(),
persistState(
window.location.href.match(
/[?&]debug_session=([^&]+)\b/
)
)
);
const store = createStore(
reducer,
enhancer
)
// Required for replaying actions from devtools to work
reduxRouterMiddleware.listenForReplays(store)
const routes = {
path: '/',
component: App,
const ROOT = process.env.NODE_ENV === 'production' ? '/redux-devtools-inspector/' : '/';
let DevTools = getDevTools(getOptions());
const reduxRouterMiddleware = routerMiddleware(browserHistory);
const enhancer = compose(
applyMiddleware(createLogger(), reduxRouterMiddleware),
(...args) => {
const useDevtoolsExtension = !!window.__REDUX_DEVTOOLS_EXTENSION__ && getOptions().useExtension;
const instrument = useDevtoolsExtension ?
window.__REDUX_DEVTOOLS_EXTENSION__() : DevTools.instrument();
return instrument(...args);
},
persistState(getDebugSessionKey())
);
const store = createStore(combineReducers({
...reducers,
routing: routerReducer
}), {}, enhancer);
const history = syncHistoryWithStore(browserHistory, store);
const handleRouterUpdate = () => {
renderApp(getOptions());
};
const router = (
}else{
newSate[x] = state[x]
}
})
return newSate
}
const middleware = [ thunkMiddleware, promiseMiddleware, routerMiddleware(history) ]
let finalCreateStore
if (__DEVCLIENT__) {
if(__DEVLOGGER__){
middleware.push(createLogger({stateTransformer}))
}
finalCreateStore = compose(
applyMiddleware(...middleware),
window.devToolsExtension ? window.devToolsExtension() : __DEVTOOLS__?DevTools.instrument():f => f,
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
)
} else {
finalCreateStore = compose(applyMiddleware(...middleware))
}
const store = finalCreateStore(createStore)(rootReducer, initialState)
if (module.hot) {
module.hot.accept('../reducers', () => {
const nextReducer = require('../reducers')
store.replaceReducer(nextReducer)
})
}
return store
}
function configureStore ({ state = initialState, routes, reducer }) {
return compose(
applyMiddleware(thunk),
applyMiddleware(routerMiddleware(browserHistory)),
DevTools.instrument(),
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
)(createStore)(reducer, state);
}
import { hashHistory } from 'react-router'
import { syncHistory } from 'react-router-redux'
import { persistState } from 'redux-devtools'
import thunk from 'redux-thunk'
import reducers from './reducers'
import DevTools from './components/DevTools'
const reduxRouterMiddleware = syncHistory(hashHistory)
const store = createStore(
combineReducers(reducers),
compose(
applyMiddleware(thunk),
applyMiddleware(reduxRouterMiddleware),
DevTools.instrument(),
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/))
)
)
reduxRouterMiddleware.listenForReplays(store)
if (module.hot) {
module.hot.accept('./reducers', () => {
const nextRootReducer = require('./reducers/index')
store.replaceReducer(nextRootReducer)
})
}
export default store
export default function configureStore(initialState, client) {
const store = composeStore(
initialState,
client,
DevTools.instrument(),
persistState(
window.location.href.match(
/[?&]debug_session=([^&]+)\b/
)
)
);
if (module.hot) {
module.hot.accept('../reducers', () =>
store.replaceReducer(require('../reducers'))
);
}
return store;
}
import { createStore, compose } from 'redux';
import { persistState } from 'redux-devtools';
import rootReducer from '../reducers';
import DevTools from '../containers/DevTools';
const finalCreateStore = compose(
DevTools.instrument(),
persistState(
window.location.href.match(
/[?&]debug_session=([^&]+)\b/
)
)
)(createStore);
export default function configureStore(initialState) {
const store = finalCreateStore(rootReducer, initialState);
if (module.hot) {
module.hot.accept('../reducers', () => store.replaceReducer(rootReducer));
}
return store;
}