How to use the redux-devtools.persistState function in redux-devtools

To help you get started, we’ve selected a few redux-devtools examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github codejunkienick / starter-lapis / app / redux / createStore.js View on Github external
// 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'));
github yuzhouisme / react-antd-redux-router-starter / src / entry / index.jsx View on Github external
// 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,
github zalmoxisus / redux-devtools-test-generator / demo / src / js / index.js View on Github external
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 = (
github jackhutu / jackblog-react / src / store / configureStore.js View on Github external
}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
}
github VirgilSecurity / virgil-sdk-javascript / examples / ip-messaging / client / frontend / modules / main / store.js View on Github external
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);
}
github goblindegook / vvv-material-dashboard / src / store.dev.js View on Github external
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
github DevAlien / dripr-ui / src / store / configureStore.dev.js View on Github external
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;
}
github calesce / redux-slider-monitor / examples / todomvc / store / configureStore.dev.js View on Github external
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;
}