mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-28 20:43:56 +03:00
fix(DevTools, LogMonitor): prevent LogMonitor to render once as visible state
This commit is contained in:
parent
aa5ee9b6c6
commit
db184f9539
|
@ -10,9 +10,26 @@ export default function createDevTools(React) {
|
||||||
ActionCreators
|
ActionCreators
|
||||||
)
|
)
|
||||||
class DevTools extends Component {
|
class DevTools extends Component {
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
visibleOnLoad: true
|
||||||
|
};
|
||||||
|
|
||||||
|
componentWillMount() {
|
||||||
|
const monitorState = {
|
||||||
|
...this.props.monitorState,
|
||||||
|
isVisible: this.props.visibleOnLoad
|
||||||
|
};
|
||||||
|
this.props.setMonitorState(monitorState);
|
||||||
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const monitorState = {
|
||||||
|
...this.props.monitorState,
|
||||||
|
isVisible: this.props.visibleOnLoad
|
||||||
|
};
|
||||||
const { monitor: Monitor } = this.props;
|
const { monitor: Monitor } = this.props;
|
||||||
return <Monitor {...this.props} />;
|
return <Monitor {...this.props} monitorState={monitorState} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -53,15 +53,13 @@ export default class LogMonitor extends Component {
|
||||||
toggleAction: PropTypes.func.isRequired,
|
toggleAction: PropTypes.func.isRequired,
|
||||||
jumpToState: PropTypes.func.isRequired,
|
jumpToState: PropTypes.func.isRequired,
|
||||||
setMonitorState: PropTypes.func.isRequired,
|
setMonitorState: PropTypes.func.isRequired,
|
||||||
select: PropTypes.func.isRequired,
|
select: PropTypes.func.isRequired
|
||||||
visibleOnLoad: PropTypes.bool
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static defaultProps = {
|
static defaultProps = {
|
||||||
select: (state) => state,
|
select: (state) => state,
|
||||||
monitorState: { isVisible: true },
|
monitorState: { isVisible: true },
|
||||||
theme: 'nicinabox',
|
theme: 'nicinabox'
|
||||||
visibleOnLoad: true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
componentWillReceiveProps(nextProps) {
|
||||||
|
@ -93,15 +91,6 @@ export default class LogMonitor extends Component {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentWillMount() {
|
|
||||||
let visibleOnLoad = this.props.visibleOnLoad;
|
|
||||||
const { monitorState } = this.props;
|
|
||||||
this.props.setMonitorState({
|
|
||||||
...monitorState,
|
|
||||||
isVisible: visibleOnLoad
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
handleRollback() {
|
handleRollback() {
|
||||||
this.props.rollback();
|
this.props.rollback();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user