diff --git a/OVERVIEW.md b/OVERVIEW.md index f91b420332..09d871462e 100644 --- a/OVERVIEW.md +++ b/OVERVIEW.md @@ -69,16 +69,20 @@ For example, adding a function component `` with an id 2: #### Removing a node -Removing a fiber from the tree (a root or a leaf) only requires sending 2 numbers: +Removing a fiber from the tree (a root or a leaf) requires sending: 1. remove operation constant (`2`) -1. fiber id +1. how many items were removed +1. number of children + * (followed by a children-first list of removed fiber ids) -For example, removing a root fiber with an id of 1: +For example, removing fibers with ids of 35 and 21: ```js [ 2, // remove operation - 1, // fiber id + 1, // number of removed fibers + 35, // first removed id + 21, // second removed id ] ``` diff --git a/src/devtools/store.js b/src/devtools/store.js index 5e9c7b0993..048568d5bb 100644 --- a/src/devtools/store.js +++ b/src/devtools/store.js @@ -601,8 +601,8 @@ export default class Store extends EventEmitter { } } - let addedElementIDs: Array = []; - let removedElementIDs: Array = []; + const addedElementIDs: Array = []; + const removedElementIDs: Array = []; let i = 2; while (i < operations.length) { @@ -811,23 +811,6 @@ export default class Store extends EventEmitter { } } element.children = Array.from(nextChildren); - - if (!element.isCollapsed) { - const prevWeight = element.weight; - - let nextWeight = element.type === ElementTypeRoot ? 0 : 1; - - nextChildren.forEach(childID => { - const child = ((this._idToElement.get(childID): any): Element); - nextWeight += child.isCollapsed ? 1 : child.weight; - }); - - element.weight = nextWeight; - // TODO: passing null here is suspicious, but it's existing behavior. - // It is suspicious because either we shouldn't need a delta at all-- - // or we should apply it to all parents, and not just this item. - this._adjustParentTreeWeight(null, nextWeight - prevWeight); - } break; } case TREE_OPERATION_UPDATE_TREE_BASE_DURATION: