Skip to content

Commit ca292f7

Browse files
authored
[DevTools] Don't show "awaited by" if there's nothing to show (#34163)
E.g. if the owner is null or the same as current component and no stack. This happens for example when you return a plain Promise in the child position and inspect the component it was returned in since there's no hook stack and the owner is the same as the instance itself so there's nothing new to link to. Before: <img width="267" height="99" alt="Screenshot 2025-08-10 at 10 28 32 PM" src="https://github.com/user-attachments/assets/23341ab2-2888-457d-a1d1-128f3e0bd5ec" /> After: <img width="253" height="91" alt="Screenshot 2025-08-10 at 10 29 04 PM" src="https://github.com/user-attachments/assets/b33bb38b-891a-4f46-bc16-15604b033cdb" />
1 parent 62a634b commit ca292f7

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,15 @@ function SuspendedByRow({
104104
// Only show the awaited stack if the I/O started in a different owner
105105
// than where it was awaited. If it's started by the same component it's
106106
// probably easy enough to infer and less noise in the common case.
107+
const canShowAwaitStack =
108+
(asyncInfo.stack !== null && asyncInfo.stack.length > 0) ||
109+
(asyncOwner !== null && asyncOwner.id !== inspectedElement.id);
107110
const showAwaitStack =
108-
!showIOStack ||
109-
(ioOwner === null
110-
? asyncOwner !== null
111-
: asyncOwner === null || ioOwner.id !== asyncOwner.id);
111+
canShowAwaitStack &&
112+
(!showIOStack ||
113+
(ioOwner === null
114+
? asyncOwner !== null
115+
: asyncOwner === null || ioOwner.id !== asyncOwner.id));
112116

113117
const value: any = ioInfo.value;
114118
const metaName =

0 commit comments

Comments
 (0)