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

This commit is contained in:
Brian Vaughn
2019-05-08 18:23:54 -07:00
parent 0722a5a024
commit 17516b76ae
3 changed files with 15 additions and 2 deletions

View File

@@ -377,6 +377,10 @@ export default class Store extends EventEmitter {
this.emit('isProfiling');
}
containsElement(id: number): boolean {
return this._idToElement.get(id) != null;
}
getElementAtIndex(index: number): Element | null {
if (index < 0 || index >= this.numElements) {
console.warn(

View File

@@ -87,3 +87,8 @@
.CannotSuspendWarningMessage {
font-size: var(--font-size-sans-large);
}
.NotInStore {
color: var(--color-dim);
cursor: default;
}

View File

@@ -306,6 +306,7 @@ function InspectedElementView({
key={owner.id}
displayName={owner.displayName}
id={owner.id}
isInStore={store.containsElement(owner.id)}
/>
))}
</div>
@@ -314,7 +315,9 @@ function InspectedElementView({
);
}
function OwnerView({ displayName, id }: { displayName: string, id: number }) {
type OwnerViewProps = {| displayName: string, id: number, isInStore: boolean |};
function OwnerView({ displayName, id, isInStore }: OwnerViewProps) {
const dispatch = useContext(TreeDispatcherContext);
const handleClick = useCallback(
@@ -329,7 +332,8 @@ function OwnerView({ displayName, id }: { displayName: string, id: number }) {
return (
<button
key={id}
className={styles.Owner}
className={`${styles.Owner} ${isInStore ? '' : styles.NotInStore}`}
disabled={!isInStore}
onClick={handleClick}
title={displayName}
>