@samitouri / QOS-React-2 / commits / bcb6c2fd9f

Removed an unnecessary entry from add-root operation array

Brian Vaughn committed Feb 28, 2019 at 08:52 UTC bcb6c2fd9fba652fefb3b529f602ba7e92dfae1c
2 files changed +7 -5
src/backend/renderer.js
+1 -2
@@ -547,11 +547,10 @@ export function attach(
547 const id = getFiberID(getPrimaryFiber(fiber));
548
549 if (isRoot) {
550 - const operation = new Uint32Array(4);
550 + const operation = new Uint32Array(3);
551 operation[0] = TREE_OPERATION_ADD;
552 operation[1] = id;
553 operation[2] = ElementTypeRoot;
554 - operation[3] = 0; // Identifies this fiber as a root
554 addOperation(operation);
555 } else {
556 const { displayName, key, type } = getDataForFiber(fiber);
src/devtools/store.js
+6 -3
@@ -6,6 +6,7 @@ import {
6 TREE_OPERATION_REMOVE,
7 TREE_OPERATION_RESET_CHILDREN,
8 } from '../constants';
9 +import { ElementTypeRoot } from './types';
10 import { utfDecodeString } from '../utils';
11 import { __DEBUG__ } from '../constants';
12
@@ -233,11 +234,10 @@ export default class Store extends EventEmitter {
234 case TREE_OPERATION_ADD:
235 id = ((operations[i + 1]: any): number);
236 type = ((operations[i + 2]: any): ElementType);
236 - parentID = ((operations[i + 3]: any): number);
237
238 - i = i + 4;
238 + i = i + 3;
239
240 - if (parentID === 0) {
240 + if (type === ElementTypeRoot) {
241 debug('Add', `new root fiber ${id}`);
242
243 if (this._idToElement.has(id)) {
@@ -263,6 +263,9 @@ export default class Store extends EventEmitter {
263 haveRootsChanged = true;
264 }
265 } else {
266 + parentID = ((operations[i]: any): number);
267 + i++;
268 +
269 ownerID = ((operations[i]: any): number);
270 i++;
271