Skip to content

Commit b88280a

Browse files
committed
Merge pull request #211 from robertknight/warn-if-store-not-instrumented
Warn and do not attempt to render if store not instrumented
2 parents 23d99f9 + afb3b8b commit b88280a

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

src/createDevTools.js

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,19 +24,36 @@ export default function createDevTools(children) {
2424

2525
constructor(props, context) {
2626
super(props, context);
27+
28+
if (!props.store && !context.store) {
29+
console.error(
30+
`DevTools cannot render because no Redux store was injected via \
31+
props or <Provide>`);
32+
return;
33+
}
34+
2735
if (context.store) {
2836
this.liftedStore = context.store.liftedStore;
2937
} else {
3038
this.liftedStore = props.store.liftedStore;
3139
}
40+
41+
if (!this.liftedStore) {
42+
console.error(
43+
`DevTools cannot render because the store not been instrumented \
44+
with DevTools.instrument()`);
45+
}
3246
}
3347

3448
render() {
49+
if (!this.liftedStore) {
50+
return null;
51+
}
52+
3553
return (
3654
<ConnectedMonitor {...monitorProps}
3755
store={this.liftedStore} />
3856
);
3957
}
4058
};
4159
}
42-

0 commit comments

Comments
 (0)