@samitouri / QOS-React / commits / 96a7adf49e

Add error logs in __DEBUG__

Dan Abramov committed Apr 5, 2019 at 18:25 UTC 96a7adf49e20197f802813224362470c66a38d20
1 file changed +16
src/devtools/store.js
+16
@@ -482,6 +482,14 @@ 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 + }
491 + }
492 +
493 if (type === ElementTypeRoot) {
494 if (__DEBUG__) {
495 debug('Add', `new root fiber ${id}`);
@@ -567,6 +575,14 @@ 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 + }
584 + }
585 +
586 i = i + 2;
587
588 element = ((this._idToElement.get(id): any): Element);