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

[DevTools] Style clickable Owner components with angle brackets and bold (#34096)

We have two type of links that appear next to each other now. One type of link jumps to a Component instance in the DevTools. The other opens a source location - e.g. in your editor. This clarifies that something will jump to the Component instance by marking it as bold and using angle brackets around the name. This can be seen in the "rendered by" list of owner as well as in the async stack traces when the stack was in a different owner than the one currently selected. <img width="516" height="387" alt="Screenshot 2025-08-03 at 11 27 38 PM" src="https://github.com/user-attachments/assets/5da50262-1e74-4e46-a6f8-96b4c1e4db31" /> The idea is to connect this styling to the owner stacks using `createTask` where this same pattern occurs (albeit the task name is not clickable): <img width="454" height="188" alt="Screenshot 2025-08-03 at 11 23 45 PM" src="https://github.com/user-attachments/assets/81a55c8f-963a-4fda-846a-97f49ef0c469" /> In fact, I was going to add the stack traces to the "rendered by" list to give the ability to jump to the JSX location in the owner stack so that it becomes this same view.

Sebastian Markbåge committed Aug 4, 2025 at 09:28 UTC d3f800d47a9f98f03e44bf30b0c3ad524110ba6d
3 files changed +6 -5
packages/react-devtools-inline/__tests__/__e2e__/components.test.js
+4 -4
@@ -52,7 +52,7 @@ test.describe('Components', () => {
52
53 test('Should allow elements to be inspected', async () => {
54 // Select the first list item in DevTools.
55 - await devToolsUtils.selectElement(page, 'ListItem', 'List\nApp');
55 + await devToolsUtils.selectElement(page, 'ListItem', '<List>\n<App>');
56
57 // Prop names/values may not be editable based on the React version.
58 // If they're not editable, make sure they degrade gracefully
@@ -119,7 +119,7 @@ test.describe('Components', () => {
119 runOnlyForReactRange('>=16.8');
120
121 // Select the first list item in DevTools.
122 - await devToolsUtils.selectElement(page, 'ListItem', 'List\nApp', true);
122 + await devToolsUtils.selectElement(page, 'ListItem', '<List>\n<App>', true);
123
124 // Then read the inspected values.
125 const sourceText = await page.evaluate(() => {
@@ -142,7 +142,7 @@ test.describe('Components', () => {
142 runOnlyForReactRange('>=16.8');
143
144 // Select the first list item in DevTools.
145 - await devToolsUtils.selectElement(page, 'ListItem', 'List\nApp');
145 + await devToolsUtils.selectElement(page, 'ListItem', '<List>\n<App>');
146
147 // Then edit the label prop.
148 await page.evaluate(() => {
@@ -177,7 +177,7 @@ test.describe('Components', () => {
177 runOnlyForReactRange('>=16.8');
178
179 // Select the List component DevTools.
180 - await devToolsUtils.selectElement(page, 'List', 'App');
180 + await devToolsUtils.selectElement(page, 'List', '<App>');
181
182 // Then click to load and parse hook names.
183 await devToolsUtils.clickButton(page, 'LoadHookNamesButton');
packages/react-devtools-shared/src/devtools/views/Components/OwnerView.css
+1
@@ -2,6 +2,7 @@
2 color: var(--color-component-name);
3 font-family: var(--font-family-monospace);
4 font-size: var(--font-size-monospace-normal);
5 + font-weight: bold;
6 white-space: nowrap;
7 overflow: hidden;
8 text-overflow: ellipsis;
packages/react-devtools-shared/src/devtools/views/Components/OwnerView.js
+1 -1
@@ -59,7 +59,7 @@ export default function OwnerView({
59 <span
60 className={`${styles.Owner} ${isInStore ? '' : styles.NotInStore}`}
61 title={displayName}>
62 - {displayName}
62 + {'<' + displayName + '>'}
63 </span>
64
65 <ElementBadges