Removed an unnecessary entry from add-root operation array

This commit is contained in:
Brian Vaughn
2019-02-28 08:52:46 -08:00
parent 13ca37384d
commit bcb6c2fd9f
2 changed files with 7 additions and 5 deletions

View File

@@ -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);

View File

@@ -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++;