mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-28 20:43:56 +03:00
Handle getting no debug_session
This commit is contained in:
parent
a5f400fa7a
commit
dec4b919eb
|
@ -55,10 +55,15 @@ const finalCreateStore = compose(
|
|||
// Provides support for DevTools:
|
||||
devTools(),
|
||||
// Lets you write ?debug_session=<name> in address bar to persist debug sessions
|
||||
persistState(window.location.href.match(/[?&]debug_session=([^&]+)\b/)[1])
|
||||
persistState(getPersistSession())
|
||||
)(createStore);
|
||||
|
||||
const store = finalCreateStore(reducer);
|
||||
|
||||
function getPersistSession() {
|
||||
const matches = window.location.href.match(/[?&]debug_session=([^&]+)\b/);
|
||||
return (matches && matches.length > 0)? matches[1] : null;
|
||||
}
|
||||
```
|
||||
|
||||
Finally, include the `DevTools` in your page. You may pass either `LogMonitor` (the default one) or any of the custom monitors described below. For convenience, you can use `DebugPanel` to dock `DevTools` to some part of the screen, but you can put it also somewhere else in the component tree.
|
||||
|
|
Loading…
Reference in New Issue
Block a user