diff --git a/src/backend/renderer.js b/src/backend/renderer.js index f3674cd369..f9d3af2bfc 100644 --- a/src/backend/renderer.js +++ b/src/backend/renderer.js @@ -547,11 +547,10 @@ export function attach( const id = getFiberID(getPrimaryFiber(fiber)); if (isRoot) { - const operation = new Uint32Array(4); + const operation = new Uint32Array(3); operation[0] = TREE_OPERATION_ADD; operation[1] = id; operation[2] = ElementTypeRoot; - operation[3] = 0; // Identifies this fiber as a root addOperation(operation); } else { const { displayName, key, type } = getDataForFiber(fiber); diff --git a/src/devtools/store.js b/src/devtools/store.js index 988bcc92a6..d59242b4d1 100644 --- a/src/devtools/store.js +++ b/src/devtools/store.js @@ -6,6 +6,7 @@ import { TREE_OPERATION_REMOVE, TREE_OPERATION_RESET_CHILDREN, } from '../constants'; +import { ElementTypeRoot } from './types'; import { utfDecodeString } from '../utils'; import { __DEBUG__ } from '../constants'; @@ -233,11 +234,10 @@ export default class Store extends EventEmitter { case TREE_OPERATION_ADD: id = ((operations[i + 1]: any): number); type = ((operations[i + 2]: any): ElementType); - parentID = ((operations[i + 3]: any): number); - i = i + 4; + i = i + 3; - if (parentID === 0) { + if (type === ElementTypeRoot) { debug('Add', `new root fiber ${id}`); if (this._idToElement.has(id)) { @@ -263,6 +263,9 @@ export default class Store extends EventEmitter { haveRootsChanged = true; } } else { + parentID = ((operations[i]: any): number); + i++; + ownerID = ((operations[i]: any): number); i++;