Hard crash
Dan Abramov committed
Apr 5, 2019 at 18:41 UTC
2a5b8a9206277e0db0e9e29c20ec9b06bc48c90f
1 file changed
+12
-12
src/devtools/store.js
+12
-12
@@ -482,12 +482,12 @@ export default class Store extends EventEmitter {
482
483
i = i + 3;
484
485
- if (__DEBUG__) {
486
- if (this._idToElement.has(id)) {
487
- console.error(
488
- 'Store already contains fiber ' + id + '. This is a bug.'
489
- );
490
- }
485
+ if (this._idToElement.has(id)) {
486
+ throw new Error(
487
+ 'Store already contains fiber ' +
488
+ id +
489
+ '. This is a bug in React DevTools.'
490
+ );
491
}
492
493
if (type === ElementTypeRoot) {
@@ -575,12 +575,12 @@ export default class Store extends EventEmitter {
575
case TREE_OPERATION_REMOVE:
576
id = ((operations[i + 1]: any): number);
577
578
- if (__DEBUG__) {
579
- if (!this._idToElement.has(id)) {
580
- console.error(
581
- 'Store does not contain fiber ' + id + '. This is a bug.'
582
- );
583
- }
578
+ if (!this._idToElement.has(id)) {
579
+ throw new Error(
580
+ 'Store does not contain fiber ' +
581
+ id +
582
+ '. This is a bug in React DevTools.'
583
+ );
584
}
585
586
i = i + 2;