mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-22 09:36:43 +03:00
Merge pull request #211 from robertknight/warn-if-store-not-instrumented
Warn and do not attempt to render if store not instrumented
This commit is contained in:
commit
b88280a7fa
|
@ -24,14 +24,32 @@ export default function createDevTools(children) {
|
|||
|
||||
constructor(props, context) {
|
||||
super(props, context);
|
||||
|
||||
if (!props.store && !context.store) {
|
||||
console.error(
|
||||
`DevTools cannot render because no Redux store was injected via \
|
||||
props or <Provide>`);
|
||||
return;
|
||||
}
|
||||
|
||||
if (context.store) {
|
||||
this.liftedStore = context.store.liftedStore;
|
||||
} else {
|
||||
this.liftedStore = props.store.liftedStore;
|
||||
}
|
||||
|
||||
if (!this.liftedStore) {
|
||||
console.error(
|
||||
`DevTools cannot render because the store not been instrumented \
|
||||
with DevTools.instrument()`);
|
||||
}
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this.liftedStore) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<ConnectedMonitor {...monitorProps}
|
||||
store={this.liftedStore} />
|
||||
|
@ -39,4 +57,3 @@ export default function createDevTools(children) {
|
|||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user