GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix: inspect ClassComponent.render instead of constructor, fixes #167… · react/react@ba932a5

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • packages/react-devtools-extensions/src
    • utils.js
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎packages/react-devtools-extensions/src/utils.js‎

Copy file name to clipboardExpand all lines: packages/react-devtools-extensions/src/utils.js
+12-1Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,21 @@ export function createViewElementSource(bridge: Bridge, store: Store) {
1212

1313
setTimeout(() => {
1414
// Ask Chrome to display the location of the component function,
15+
// or a render method if it is a Class (ideally Class instance, not type)
1516
// assuming the renderer found one.
1617
chrome.devtools.inspectedWindow.eval(`
1718
if (window.$type != null) {
18-
inspect(window.$type);
19+
if (
20+
window.$type &&
21+
window.$type.prototype &&
22+
window.$type.prototype.isReactComponent
23+
) {
24+
// inspect Component.render, not constructor
25+
inspect(window.$type.prototype.render);
26+
} else {
27+
// inspect Functional Component
28+
inspect(window.$type);
29+
}
1930
}
2031
`);
2132
}, 100);

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.