@samitouri / QOS-React-2 / commits / ca292f7a57

[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" />

Sebastian Markbåge committed Aug 11, 2025 at 11:48 UTC ca292f7a57e8c5950cda51f1aa00509dbb07dbf1
1 file changed +8 -4
packages/react-devtools-shared/src/devtools/views/Components/InspectedElementSuspendedBy.js
+8 -4
@@ -104,11 +104,15 @@ function SuspendedByRow({
104 // Only show the awaited stack if the I/O started in a different owner
105 // than where it was awaited. If it's started by the same component it's
106 // 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);
110 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));
116
117 const value: any = ioInfo.value;
118 const metaName =