@samitouri / QOS-React-2 / commits / 17516b76ae

Dim owners that have been filtered from the tree in rendered-by list

Brian Vaughn committed May 8, 2019 at 18:23 UTC 17516b76ae763ec7c4dfa09d826164d6bb2e41c0
3 files changed +15 -2
src/devtools/store.js
+4
@@ -377,6 +377,10 @@ export default class Store extends EventEmitter {
377 this.emit('isProfiling');
378 }
379
380 + containsElement(id: number): boolean {
381 + return this._idToElement.get(id) != null;
382 + }
383 +
384 getElementAtIndex(index: number): Element | null {
385 if (index < 0 || index >= this.numElements) {
386 console.warn(
src/devtools/views/Components/SelectedElement.css
+5
@@ -87,3 +87,8 @@
87 .CannotSuspendWarningMessage {
88 font-size: var(--font-size-sans-large);
89 }
90 +
91 +.NotInStore {
92 + color: var(--color-dim);
93 + cursor: default;
94 +}
src/devtools/views/Components/SelectedElement.js
+6 -2
@@ -306,6 +306,7 @@ function InspectedElementView({
306 key={owner.id}
307 displayName={owner.displayName}
308 id={owner.id}
309 + isInStore={store.containsElement(owner.id)}
310 />
311 ))}
312 </div>
@@ -314,7 +315,9 @@ function InspectedElementView({
315 );
316 }
317
317 -function OwnerView({ displayName, id }: { displayName: string, id: number }) {
318 +type OwnerViewProps = {| displayName: string, id: number, isInStore: boolean |};
319 +
320 +function OwnerView({ displayName, id, isInStore }: OwnerViewProps) {
321 const dispatch = useContext(TreeDispatcherContext);
322
323 const handleClick = useCallback(
@@ -329,7 +332,8 @@ function OwnerView({ displayName, id }: { displayName: string, id: number }) {
332 return (
333 <button
334 key={id}
332 - className={styles.Owner}
335 + className={`${styles.Owner} ${isInStore ? '' : styles.NotInStore}`}
336 + disabled={!isInStore}
337 onClick={handleClick}
338 title={displayName}
339 >