[DevTools] Add React Element pane to browser Elements panel#212
[DevTools] Add React Element pane to browser Elements panel#212everettbu wants to merge 1 commit into
Conversation
c63fec5 to
98337e1
Compare
Greptile OverviewGreptile SummaryThis PR adds a dedicated "React Element" pane to the browser's Elements panel, enabling developers to inspect React elements and open their source code directly from the DOM inspector.
Issues Found:
Confidence Score: 3/5
Important Files ChangedFile Analysis
|
Additional Comments (3)
Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/react-devtools-extensions/src/main/index.js
Line: 486:490
Comment:
[P1] The condition should include `editorPortalContainer` and `inspectedElementPortalContainer` to prevent memory leak. If a user opens only the sidebar panes (Editor or Inspected Element) without opening the main panels, the root won't be unmounted on cleanup. This extends a pre-existing bug with `editorPortalContainer`.
How can I resolve this? If you propose a fix, please make it concise.
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time! Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/react-devtools-extensions/src/main/index.js
Line: 498:500
Comment:
[P2] Should nullify `editorPortalContainer` and `inspectedElementPortalContainer` for consistency with other cleanup operations. This extends a pre-existing issue with `editorPortalContainer`.
<sub>Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!</sub>
How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/react-devtools-extensions/src/main/index.js
Line: 451:455
Comment:
[P1] Same memory leak issue as in `performFullCleanup`: should include `editorPortalContainer` and `inspectedElementPortalContainer` in the condition to ensure root is unmounted when sidebar panes are used.
How can I resolve this? If you propose a fix, please make it concise. |
98337e1 to
3bcc570
Compare
| export type Props = {}; | ||
|
|
||
| function InspectedElementPane(_: Props) { |
There was a problem hiding this comment.
selectedSource prop is passed from DevTools.js (line 387) but not defined in Props type or used in the component
Prompt To Fix With AI
This is a comment left during a code review.
Path: packages/react-devtools-shared/src/devtools/views/InspectedElement/InspectedElementPane.js
Line: 21:23
Comment:
`selectedSource` prop is passed from `DevTools.js` (line 387) but not defined in Props type or used in the component
How can I resolve this? If you propose a fix, please make it concise.
Additional Comments (1)
Prompt To Fix With AIThis is a comment left during a code review.
Path: packages/react-devtools-extensions/src/main/index.js
Line: 487:491
Comment:
condition should include `editorPortalContainer` and `inspectedElementPortalContainer` to prevent memory leak if user only opens sidebar panes without opening main panels (extends pre-existing bug with `editorPortalContainer`)
How can I resolve this? If you propose a fix, please make it concise. |
|
Upstream PR was closed or merged. Code is synced via branch mirror. |
Mirror of facebook/react#35240
Original author: eps1lon
Closes react/react#32574
Adds a dedicated pane for inspecting the React Element that rendered the inspected DOM element.
The main motivation is having an affordance to open the source where the DOM element is rendered.
CleanShot.2025-11-28.at.00.25.16.mp4
The new pane has three UX quirks:
I feel like this should trigger de-selection instead
[DevTools] Clear element inspection if host element not owned by any renderer is selected react/react#35504
So far no fallback was good enough for the Components and Suspense tab because you couldn't escape React Elements in those tabs. In the browsers Elements panel it's much easier to do so a fallback is warranted. Probably fine to add the fallback in every context.
[DevTools] Show fallback in inspected element pane when no element is selected react/react#35503
I don't have a solution for that yet. Maybe that's fine in the end and it's something you get used to. The main problem right now is that initial load ignores the users setting and hides host Elements by default. Fixing that particular bug might help this issue the most.
I'll work on 1 and 2 in follow-ups that should be handled before the next release. For 3, I want to investigate why the initial load always uses the default filter and if we can fix that.
Other follow-ups before release: