redux-devtools
Advanced tools
Comparing version 2.0.0 to 2.1.0
@@ -10,2 +10,4 @@ 'use strict'; | ||
function persistState(sessionId) { | ||
var deserializer = arguments.length <= 1 || arguments[1] === undefined ? null : arguments[1]; | ||
if (!sessionId) { | ||
@@ -19,2 +21,16 @@ return function (next) { | ||
function deserializeState(fullState) { | ||
if (!fullState || typeof deserializer !== 'function') { | ||
return fullState; | ||
} | ||
return _extends({}, fullState, { | ||
committedState: deserializer(fullState.committedState), | ||
computedStates: fullState.computedStates.map(function (computedState) { | ||
return _extends({}, computedState, { | ||
state: deserializer(computedState.state) | ||
}); | ||
}) | ||
}); | ||
} | ||
return function (next) { | ||
@@ -26,3 +42,3 @@ return function (reducer, initialState) { | ||
try { | ||
finalInitialState = JSON.parse(localStorage.getItem(key)) || initialState; | ||
finalInitialState = deserializeState(JSON.parse(localStorage.getItem(key))) || initialState; | ||
next(reducer, initialState); | ||
@@ -29,0 +45,0 @@ } catch (e) { |
@@ -98,2 +98,11 @@ 'use strict'; | ||
LogMonitor.prototype.componentWillMount = function componentWillMount() { | ||
var visibleOnLoad = this.props.visibleOnLoad; | ||
var monitorState = this.props.monitorState; | ||
this.props.setMonitorState(_extends({}, monitorState, { | ||
isVisible: visibleOnLoad | ||
})); | ||
}; | ||
LogMonitor.prototype.handleRollback = function handleRollback() { | ||
@@ -229,3 +238,4 @@ this.props.rollback(); | ||
setMonitorState: _react.PropTypes.func.isRequired, | ||
select: _react.PropTypes.func.isRequired | ||
select: _react.PropTypes.func.isRequired, | ||
visibleOnLoad: _react.PropTypes.bool | ||
}, | ||
@@ -240,3 +250,4 @@ enumerable: true | ||
monitorState: { isVisible: true }, | ||
theme: 'nicinabox' | ||
theme: 'nicinabox', | ||
visibleOnLoad: true | ||
}, | ||
@@ -243,0 +254,0 @@ enumerable: true |
{ | ||
"name": "redux-devtools", | ||
"version": "2.0.0", | ||
"version": "2.1.0", | ||
"description": "Redux DevTools with hot reloading and time travel", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -16,4 +16,5 @@ Redux DevTools | ||
* With `persistState()` store enhancer, you can persist debug sessions across page reloads | ||
* To monitor a part of the state, you can set a `select` prop on the DevTools component: `<DevTools select={state => state.todos} store={store} monitor={LogMonitor} />` | ||
* To monitor a part of the state, you can set a `select` prop on the DevTools component: `<DevTools select={state => state.todos} store={store} monitor={LogMonitor} />` | ||
* Toggle visibility with Ctrl+H | ||
* To hide the devtools on load, set `visibleOnLoad` to false, e.g.: `<DevTools store={store} monitor={LogMonitor} visibleOnLoad={false} />` | ||
@@ -20,0 +21,0 @@ ### Installation |
71625
1863
131