@samitouri / QOS-React / commits / efb5855c8c

Nits

Dan committed Apr 19, 2019 at 13:17 UTC efb5855c8c43511e3e6ed134660ed82aafcda829
2 files changed +10 -23
OVERVIEW.md
+8 -4
@@ -69,16 +69,20 @@ For example, adding a function component `<Foo>` with an id 2:
69
70 #### Removing a node
71
72 -Removing a fiber from the tree (a root or a leaf) only requires sending 2 numbers:
72 +Removing a fiber from the tree (a root or a leaf) requires sending:
73
74 1. remove operation constant (`2`)
75 -1. fiber id
75 +1. how many items were removed
76 +1. number of children
77 + * (followed by a children-first list of removed fiber ids)
78
77 -For example, removing a root fiber with an id of 1:
79 +For example, removing fibers with ids of 35 and 21:
80 ```js
81 [
82 2, // remove operation
81 - 1, // fiber id
83 + 1, // number of removed fibers
84 + 35, // first removed id
85 + 21, // second removed id
86 ]
87 ```
88
src/devtools/store.js
+2 -19
@@ -601,8 +601,8 @@ export default class Store extends EventEmitter {
601 }
602 }
603
604 - let addedElementIDs: Array<number> = [];
605 - let removedElementIDs: Array<number> = [];
604 + const addedElementIDs: Array<number> = [];
605 + const removedElementIDs: Array<number> = [];
606
607 let i = 2;
608 while (i < operations.length) {
@@ -811,23 +811,6 @@ export default class Store extends EventEmitter {
811 }
812 }
813 element.children = Array.from(nextChildren);
814 -
815 - if (!element.isCollapsed) {
816 - const prevWeight = element.weight;
817 -
818 - let nextWeight = element.type === ElementTypeRoot ? 0 : 1;
819 -
820 - nextChildren.forEach(childID => {
821 - const child = ((this._idToElement.get(childID): any): Element);
822 - nextWeight += child.isCollapsed ? 1 : child.weight;
823 - });
824 -
825 - element.weight = nextWeight;
826 - // TODO: passing null here is suspicious, but it's existing behavior.
827 - // It is suspicious because either we shouldn't need a delta at all--
828 - // or we should apply it to all parents, and not just this item.
829 - this._adjustParentTreeWeight(null, nextWeight - prevWeight);
830 - }
814 break;
815 }
816 case TREE_OPERATION_UPDATE_TREE_BASE_DURATION: