@samitouri / QOS-React-2 / commits / 102267b1d6

Renamed _numElements attribute based on PR feedback

Brian Vaughn committed Apr 10, 2019 at 07:31 UTC 102267b1d61b4362eb6cfeaebe226548d318027d
1 file changed +7 -7
src/devtools/store.js
+7 -7
@@ -71,10 +71,6 @@ export default class Store extends EventEmitter {
71 // When profiling is in progress, operations are stored so that we can later reconstruct past commit trees.
72 _isProfiling: boolean = false;
73
74 - // Total number of visible elements (within all roots).
75 - // Used for windowing purposes.
76 - _numElements: number = 0;
77 -
74 // Suspense cache for reading profilign data.
75 _profilingCache: ProfilingCache;
76
@@ -112,6 +108,10 @@ export default class Store extends EventEmitter {
108 _supportsProfiling: boolean = false;
109 _supportsReloadAndProfile: boolean = false;
110
111 + // Total number of visible elements (within all roots).
112 + // Used for windowing purposes.
113 + _weightAcrossRoots: number = 0;
114 +
115 constructor(bridge: Bridge, config?: Config) {
116 super();
117
@@ -198,7 +198,7 @@ export default class Store extends EventEmitter {
198 }
199
200 get numElements(): number {
201 - return this._numElements;
201 + return this._weightAcrossRoots;
202 }
203
204 get profilingCache(): ProfilingCache {
@@ -429,7 +429,7 @@ export default class Store extends EventEmitter {
429
430 const weightDelta = isCollapsed ? 1 - element.weight : element.weight - 1;
431
432 - this._numElements += weightDelta;
432 + this._weightAcrossRoots += weightDelta;
433
434 let parentElement = this._idToElement.get(element.parentID);
435 while (parentElement != null) {
@@ -760,7 +760,7 @@ export default class Store extends EventEmitter {
760
761 // Additions and deletions within a collapsed subtree should not affect the overall number of elements.
762 if (!isInsideCollapsedSubTree) {
763 - this._numElements += weightDelta;
763 + this._weightAcrossRoots += weightDelta;
764 }
765 }
766