mirror of
https://github.com/facebook/react.git
synced 2026-02-23 20:23:02 +00:00
Dim owners that have been filtered from the tree in rendered-by list
This commit is contained in:
@@ -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(
|
||||
|
||||
@@ -87,3 +87,8 @@
|
||||
.CannotSuspendWarningMessage {
|
||||
font-size: var(--font-size-sans-large);
|
||||
}
|
||||
|
||||
.NotInStore {
|
||||
color: var(--color-dim);
|
||||
cursor: default;
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user