From 2a5b8a9206277e0db0e9e29c20ec9b06bc48c90f Mon Sep 17 00:00:00 2001 From: Dan Abramov Date: Fri, 5 Apr 2019 18:41:13 +0100 Subject: [PATCH] Hard crash --- src/devtools/store.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/devtools/store.js b/src/devtools/store.js index 8231845ede..fdafcb3f5c 100644 --- a/src/devtools/store.js +++ b/src/devtools/store.js @@ -482,12 +482,12 @@ export default class Store extends EventEmitter { i = i + 3; - if (__DEBUG__) { - if (this._idToElement.has(id)) { - console.error( - 'Store already contains fiber ' + id + '. This is a bug.' - ); - } + if (this._idToElement.has(id)) { + throw new Error( + 'Store already contains fiber ' + + id + + '. This is a bug in React DevTools.' + ); } if (type === ElementTypeRoot) { @@ -575,12 +575,12 @@ export default class Store extends EventEmitter { case TREE_OPERATION_REMOVE: id = ((operations[i + 1]: any): number); - if (__DEBUG__) { - if (!this._idToElement.has(id)) { - console.error( - 'Store does not contain fiber ' + id + '. This is a bug.' - ); - } + if (!this._idToElement.has(id)) { + throw new Error( + 'Store does not contain fiber ' + + id + + '. This is a bug in React DevTools.' + ); } i = i + 2;