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 Component Stacks for IE and Native Classes in Safari by sebmarkbage · Pull Request #18575 · react/react

Conversation

@sebmarkbage

@sebmarkbage sebmarkbage commented Apr 11, 2020

Copy link
Copy Markdown
Contributor

This is a follow up to #18561

It adds more test cases and includes a fix to Safari since Safari adds another stack frame for the construct call. Polyfills might do something similar so this tries to be resilient by skipping over those.

Results from fixtures

Chrome:


    at Lazy
    at Component (http://localhost:8000/fixtures/stacks/Components.js:7:50)
    at div
    at Suspense
    at BabelClassWithFields (http://localhost:8000/fixtures/stacks/BabelClasses-compiled.js:54:31)
    at BabelClass (http://localhost:8000/fixtures/stacks/BabelClasses-compiled.js:36:29)
    at FrozenClass (http://localhost:8000/fixtures/stacks/Components.js:24:5)
    at NativeClass (http://localhost:8000/fixtures/stacks/Components.js:16:1)
    at SuspenseList
    at Custom Name (http://localhost:8000/fixtures/stacks/Components.js:11:23)
    at ErrorBoundary (http://localhost:8000/fixtures/stacks/Example.js:5:1)
    at Example (http://localhost:8000/fixtures/stacks/Example.js:33:21)

Firefox:


Lazy
Component@http://localhost:8000/fixtures/stacks/Components.js:7:1
div
Suspense
BabelClassWithFields@http://localhost:8000/fixtures/stacks/BabelClasses-compiled.js:54:31
BabelClass@http://localhost:8000/fixtures/stacks/BabelClasses-compiled.js:36:29
FrozenClass@http://localhost:8000/fixtures/stacks/Components.js:24:5
NativeClass@http://localhost:8000/fixtures/stacks/Components.js:16:49
SuspenseList
DisplayName@http://localhost:8000/fixtures/stacks/Components.js:11:1
ErrorBoundary@http://localhost:8000/fixtures/stacks/Example.js:5:49
Example@http://localhost:8000/fixtures/stacks/Example.js:33:21

Note: Firefox doesn't respect displayName in stack traces.

Safari:


Lazy
Component@http://localhost:8000/fixtures/stacks/Components.js:7:48
div
Suspense
BabelClassWithFields@http://localhost:8000/fixtures/stacks/BabelClasses-compiled.js:54:35
BabelClass@http://localhost:8000/fixtures/stacks/BabelClasses-compiled.js:36:34
FrozenClass@http://localhost:8000/fixtures/stacks/Components.js:24:10
NativeClass
SuspenseList
Custom Name@http://localhost:8000/fixtures/stacks/Components.js:11:21
ErrorBoundary
Example@http://localhost:8000/fixtures/stacks/Example.js:33:29

Note: Safari doesn't give us a line number for native classes without an explicit constructor.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
sebmarkbage added 2 commits April 10, 2020 17:13
@sebmarkbage
Add more edge cases to fixture
ac9651d
Also adjust some expectations. I think the column should ideally be 1 but varies.
The Example row is one line off because it throws on the hook but should ideally be the component.
Similarly class components with constructors may have the line in the constructor.
@sebmarkbage
Account for the construct call taking a stack frame
526ce6e
We do this by first searching for the first different frame, then find
the same frames and then find the first different frame again.
@sebmarkbage
sebmarkbage requested review from acdlite, bvaughn and gaearon April 11, 2020 00:21
@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 11, 2020
@codesandbox-ci

codesandbox-ci Bot commented Apr 11, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 5007c88:

Sandbox Source
condescending-wilson-0pdup Configuration
All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sizebot

sizebot commented Apr 11, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Details of bundled changes.

Comparing: 98d410f...5007c88

react

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react.development.js +0.9% +0.7% 110.44 KB 111.38 KB 26.99 KB 27.18 KB UMD_DEV
react.production.min.js 0.0% 0.0% 12.29 KB 12.29 KB 4.82 KB 4.82 KB UMD_PROD
JSXRuntime-dev.js +2.2% +1.5% 38.68 KB 39.54 KB 11 KB 11.17 KB FB_WWW_DEV
react-jsx-dev-runtime.development.js +2.6% +1.7% 33.93 KB 34.81 KB 10.09 KB 10.26 KB NODE_DEV
react-jsx-dev-runtime.production.min.js 0.0% 🔺+0.3% 454 B 454 B 321 B 322 B NODE_PROD
JSXDEVRuntime-dev.js +2.3% +1.5% 38.1 KB 38.96 KB 10.83 KB 10.99 KB FB_WWW_DEV
react-jsx-runtime.development.js +2.5% +1.7% 34.51 KB 35.39 KB 10.26 KB 10.43 KB NODE_DEV
react.development.js +1.2% +1.0% 71.62 KB 72.5 KB 19.25 KB 19.44 KB NODE_DEV
react.production.min.js 0.0% 0.0% 7.27 KB 7.27 KB 2.89 KB 2.89 KB NODE_PROD
React-dev.js +0.9% +0.7% 96.85 KB 97.71 KB 23.71 KB 23.88 KB FB_WWW_DEV

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom-server.browser.development.js +0.6% +0.4% 161.26 KB 162.2 KB 41.04 KB 41.21 KB UMD_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 23.39 KB 23.39 KB 8.6 KB 8.6 KB UMD_PROD
react-dom.profiling.min.js +0.2% +0.2% 128.26 KB 128.53 KB 40.11 KB 40.19 KB NODE_PROFILING
ReactDOM-dev.js +0.1% +0.1% 988.57 KB 989.54 KB 219.72 KB 219.94 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.2% 🔺+0.2% 412.5 KB 413.18 KB 74.82 KB 74.96 KB FB_WWW_PROD
ReactDOM-profiling.js +0.2% +0.2% 423.4 KB 424.08 KB 76.67 KB 76.81 KB FB_WWW_PROFILING
react-dom-test-utils.development.js 0.0% 0.0% 75.14 KB 75.14 KB 20.12 KB 20.12 KB UMD_DEV
ReactDOMTesting-dev.js 0.0% 0.0% 931.52 KB 931.63 KB 207.54 KB 207.58 KB FB_WWW_DEV
ReactDOMTesting-prod.js 0.0% 🔺+0.1% 393.62 KB 393.72 KB 71.77 KB 71.81 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% 0.0% 69.98 KB 69.98 KB 19.61 KB 19.61 KB NODE_DEV
ReactDOMTesting-profiling.js 0.0% +0.1% 393.62 KB 393.72 KB 71.77 KB 71.81 KB FB_WWW_PROFILING
react-dom-server.node.development.js +0.6% +0.4% 153.02 KB 153.9 KB 40.52 KB 40.69 KB NODE_DEV
react-dom-test-utils.production.min.js 0.0% -0.0% 13.1 KB 13.1 KB 4.81 KB 4.81 KB NODE_PROD
react-dom-server.node.production.min.js 0.0% 0.0% 23.69 KB 23.69 KB 8.72 KB 8.72 KB NODE_PROD
react-dom-server.browser.development.js +0.6% +0.4% 151.8 KB 152.68 KB 40.27 KB 40.44 KB NODE_DEV
react-dom-server.browser.production.min.js 0.0% 0.0% 23.28 KB 23.28 KB 8.57 KB 8.57 KB NODE_PROD
react-dom.development.js +0.1% +0.1% 939.84 KB 940.9 KB 205.37 KB 205.6 KB UMD_DEV
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 56.11 KB 56.11 KB 13.85 KB 13.85 KB UMD_DEV
react-dom.production.min.js 🔺+0.2% 🔺+0.2% 124.06 KB 124.33 KB 39.64 KB 39.71 KB UMD_PROD
ReactDOMForked-dev.js +0.1% +0.1% 988.59 KB 989.56 KB 219.87 KB 220.09 KB FB_WWW_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 10 KB 10 KB 3.36 KB 3.36 KB UMD_PROD
ReactDOMServer-dev.js +0.5% +0.4% 160.6 KB 161.46 KB 40.83 KB 40.99 KB FB_WWW_DEV
react-dom.profiling.min.js +0.2% +0.2% 127.91 KB 128.18 KB 40.87 KB 40.93 KB UMD_PROFILING
ReactDOMForked-prod.js 🔺+0.2% 🔺+0.2% 413.07 KB 413.75 KB 74.91 KB 75.04 KB FB_WWW_PROD
react-dom.development.js +0.1% +0.1% 894.89 KB 895.88 KB 202.89 KB 203.11 KB NODE_DEV
ReactDOMForked-profiling.js +0.2% +0.2% 423.97 KB 424.65 KB 76.77 KB 76.91 KB FB_WWW_PROFILING
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 53.21 KB 53.21 KB 13.65 KB 13.65 KB NODE_DEV
react-dom.production.min.js 🔺+0.2% 🔺+0.2% 124.26 KB 124.53 KB 38.87 KB 38.96 KB NODE_PROD
react-dom-unstable-fizz.node.production.min.js 0.0% -0.3% 1.17 KB 1.17 KB 669 B 667 B NODE_PROD

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js +0.2% +0.2% 657.16 KB 658.21 KB 138.22 KB 138.44 KB UMD_DEV
react-art.production.min.js 🔺+0.2% 🔺+0.2% 110.19 KB 110.46 KB 33.35 KB 33.43 KB UMD_PROD
react-art.development.js +0.2% +0.2% 560.53 KB 561.52 KB 120.7 KB 120.9 KB NODE_DEV
react-art.production.min.js 🔺+0.4% 🔺+0.4% 75.14 KB 75.41 KB 22.57 KB 22.66 KB NODE_PROD
ReactART-dev.js +0.2% +0.2% 594.93 KB 595.9 KB 125.2 KB 125.4 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.3% 🔺+0.4% 242.98 KB 243.66 KB 41.26 KB 41.41 KB FB_WWW_PROD

react-reconciler

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-reconciler-reflection.development.js 0.0% 0.0% 16.23 KB 16.23 KB 4.92 KB 4.92 KB NODE_DEV
react-reconciler.development.js +0.2% +0.2% 602.26 KB 603.25 KB 127.35 KB 127.55 KB NODE_DEV
react-reconciler.production.min.js 🔺+0.3% 🔺+0.4% 80.54 KB 80.82 KB 23.83 KB 23.91 KB NODE_PROD

ReactDOM: size: 0.0%, gzip: 0.0%

React: size: 0.0%, gzip: 0.0%

Size changes (experimental)

Generated by 🚫 dangerJS against 5007c88

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sizebot

sizebot commented Apr 11, 2020 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Details of bundled changes.

Comparing: 98d410f...5007c88

react

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
JSXDEVRuntime-dev.js +2.3% +1.6% 38.1 KB 38.96 KB 10.83 KB 11 KB FB_WWW_DEV
react-jsx-runtime.development.js 0.0% 0.0% 30.14 KB 30.14 KB 8.89 KB 8.9 KB NODE_DEV
react-jsx-runtime.profiling.min.js 0.0% +0.2% 946 B 946 B 594 B 595 B NODE_PROFILING
JSXRuntime-dev.js +2.2% +1.5% 38.68 KB 39.54 KB 11 KB 11.17 KB FB_WWW_DEV
react.profiling.min.js 0.0% -0.0% 14.9 KB 14.9 KB 5.63 KB 5.63 KB UMD_PROFILING
react.development.js 0.0% 0.0% 63.43 KB 63.43 KB 17.06 KB 17.06 KB NODE_DEV
React-dev.js +0.9% +0.7% 97.84 KB 98.7 KB 23.9 KB 24.08 KB FB_WWW_DEV
React-prod.js 0.0% 0.0% 17.3 KB 17.3 KB 4.53 KB 4.53 KB FB_WWW_PROD
react-jsx-dev-runtime.development.js 0.0% 0.0% 29.56 KB 29.56 KB 8.72 KB 8.72 KB NODE_DEV
React-profiling.js 0.0% 0.0% 17.3 KB 17.3 KB 4.53 KB 4.53 KB FB_WWW_PROFILING
react-jsx-dev-runtime.profiling.min.js 0.0% +0.3% 440 B 440 B 312 B 313 B NODE_PROFILING

react-dom

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 119.63 KB 119.7 KB 37.5 KB 37.54 KB NODE_PROD
react-dom-test-utils.development.js 0.0% 0.0% 75.12 KB 75.12 KB 20.11 KB 20.11 KB UMD_DEV
ReactDOMTesting-profiling.js 0.0% 0.0% 405.44 KB 405.55 KB 73.56 KB 73.59 KB FB_WWW_PROFILING
react-dom-server.browser.production.min.js 0.0% 0.0% 22.82 KB 22.82 KB 8.48 KB 8.49 KB NODE_PROD
react-dom.profiling.min.js +0.1% +0.1% 123.51 KB 123.58 KB 38.63 KB 38.67 KB NODE_PROFILING
react-dom-server.node.development.js 0.0% 0.0% 147.14 KB 147.14 KB 38.93 KB 38.93 KB NODE_DEV
react-dom-server.node.production.min.js 0.0% 0.0% 23.23 KB 23.23 KB 8.65 KB 8.65 KB NODE_PROD
ReactDOMForked-dev.js +0.1% +0.1% 1013.85 KB 1014.82 KB 225.11 KB 225.33 KB FB_WWW_DEV
ReactDOMForked-prod.js 🔺+0.2% 🔺+0.2% 424.5 KB 425.18 KB 76.56 KB 76.69 KB FB_WWW_PROD
react-dom.development.js 0.0% 0.0% 907.09 KB 907.21 KB 199.11 KB 199.15 KB UMD_DEV
ReactDOMForked-profiling.js +0.2% +0.2% 435.46 KB 436.14 KB 78.45 KB 78.58 KB FB_WWW_PROFILING
react-dom-server.browser.development.js 0.0% 0.0% 155.09 KB 155.09 KB 39.44 KB 39.45 KB UMD_DEV
react-dom-unstable-fizz.node.production.min.js 0.0% -0.2% 1.16 KB 1.16 KB 660 B 659 B NODE_PROD
react-dom.production.min.js 🔺+0.1% 🔺+0.1% 119.51 KB 119.58 KB 38.23 KB 38.26 KB UMD_PROD
react-dom-server.browser.production.min.js 0.0% 0.0% 22.92 KB 22.92 KB 8.51 KB 8.52 KB UMD_PROD
react-dom.profiling.min.js +0.1% +0.1% 123.25 KB 123.32 KB 39.48 KB 39.51 KB UMD_PROFILING
ReactDOMTesting-dev.js 0.0% 0.0% 958.06 KB 958.17 KB 213.18 KB 213.22 KB FB_WWW_DEV
react-dom.development.js 0.0% 0.0% 863.52 KB 863.63 KB 196.67 KB 196.72 KB NODE_DEV
ReactDOMTesting-prod.js 0.0% 0.0% 405.44 KB 405.55 KB 73.56 KB 73.59 KB FB_WWW_PROD
react-dom-server.browser.development.js 0.0% 0.0% 145.92 KB 145.92 KB 38.68 KB 38.68 KB NODE_DEV
ReactDOM-dev.js +0.1% +0.1% 1013.83 KB 1014.81 KB 224.96 KB 225.18 KB FB_WWW_DEV
ReactDOMServer-dev.js +0.5% +0.4% 164.1 KB 164.96 KB 41.73 KB 41.89 KB FB_WWW_DEV
ReactDOM-prod.js 🔺+0.2% 🔺+0.2% 423.91 KB 424.6 KB 76.46 KB 76.6 KB FB_WWW_PROD
react-dom-test-utils.development.js 0.0% 0.0% 69.97 KB 69.97 KB 19.6 KB 19.6 KB NODE_DEV
ReactDOMServer-prod.js 0.0% 0.0% 53.3 KB 53.3 KB 12.85 KB 12.85 KB FB_WWW_PROD
ReactDOM-profiling.js +0.2% +0.2% 434.87 KB 435.56 KB 78.37 KB 78.51 KB FB_WWW_PROFILING
react-dom-test-utils.production.min.js 0.0% -0.0% 13.09 KB 13.09 KB 4.8 KB 4.8 KB NODE_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 56.1 KB 56.1 KB 13.84 KB 13.84 KB UMD_DEV
react-dom-unstable-native-dependencies.production.min.js 0.0% 0.0% 9.98 KB 9.98 KB 3.36 KB 3.36 KB UMD_PROD
react-dom-unstable-native-dependencies.development.js 0.0% 0.0% 53.2 KB 53.2 KB 13.64 KB 13.65 KB NODE_DEV

react-art

File Filesize Diff Gzip Diff Prev Size Current Size Prev Gzip Current Gzip ENV
react-art.development.js 0.0% 0.0% 633.97 KB 634.08 KB 133.61 KB 133.64 KB UMD_DEV
react-art.production.min.js 🔺+0.1% 🔺+0.1% 107.11 KB 107.18 KB 32.46 KB 32.51 KB UMD_PROD
react-art.development.js 0.0% 0.0% 538.28 KB 538.39 KB 116.03 KB 116.07 KB NODE_DEV
react-art.production.min.js 🔺+0.1% 🔺+0.2% 72.11 KB 72.18 KB 21.65 KB 21.69 KB NODE_PROD
ReactART-dev.js +0.2% +0.2% 604.99 KB 605.96 KB 127.22 KB 127.41 KB FB_WWW_DEV
ReactART-prod.js 🔺+0.3% 🔺+0.3% 250.43 KB 251.11 KB 42.54 KB 42.66 KB FB_WWW_PROD

Size changes (stable)

Generated by 🚫 dangerJS against 5007c88

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sebmarkbage

sebmarkbage commented Apr 11, 2020

Copy link
Copy Markdown
Contributor Author

There's still one more issue to solve after this. Internet Explorer requires an error to be thrown before it gets a stack. So I'll need to throw instead of just creating the controls.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

gaearon
gaearon approved these changes Apr 11, 2020
View reviewed changes
@sebmarkbage
Throw controls
29bc28a
Otherwise they don't get a stack frame associated with them in IE.
@sebmarkbage
sebmarkbage force-pushed the proderrorstacks branch from 7e8f30d to b8df429 Compare April 11, 2020 01:27
@sebmarkbage

sebmarkbage commented Apr 11, 2020

Copy link
Copy Markdown
Contributor Author

Ok after these changes it works in IE/Edge.

Edge


   at Lazy
   at Component (http://localhost:8000/fixtures/stacks/Components.js:7:49)
   at div
   at Suspense
   at BabelClassWithFields (http://localhost:8000/fixtures/stacks/BabelClasses-compiled.js:54:5)
   at BabelClass (http://localhost:8000/fixtures/stacks/BabelClasses-compiled.js:36:5)
   at FrozenClass (http://localhost:8000/fixtures/stacks/Components.js:24:5)
   at NativeClass (http://localhost:8000/fixtures/stacks/Components.js:16:43)
   at SuspenseList
   at DisplayName (http://localhost:8000/fixtures/stacks/Components.js:11:22)
   at ErrorBoundary (http://localhost:8000/fixtures/stacks/Example.js:5:45)
   at Example (http://localhost:8000/fixtures/stacks/Example.js:33:3)

IE10/11

After adjusting the fixtures to avoid ES2015 features.


   at Lazy
   at Component (http://localhost:8000/fixtures/stacks/Components.js:8:3)
   at div
   at Suspense
   at BabelClassWithFields (http://localhost:8000/fixtures/stacks/BabelClasses-compiled.js:54:5)
   at BabelClass (http://localhost:8000/fixtures/stacks/BabelClasses-compiled.js:36:5)
   at FrozenClass (http://localhost:8000/fixtures/stacks/Components.js:25:3)
   at NativeClass (http://localhost:8000/fixtures/stacks/Components.js:17:3)
   at SuspenseList
   at DisplayName (http://localhost:8000/fixtures/stacks/Components.js:12:3)
   at ErrorBoundary (http://localhost:8000/fixtures/stacks/Example.js:6:3)
   at Example (http://localhost:8000/fixtures/stacks/Example.js:36:3)

Notably IE8/9 doesn't give you a stack on errors.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sebmarkbage
sebmarkbage force-pushed the proderrorstacks branch from 672e19b to 28d7c0a Compare April 11, 2020 02:13
@sebmarkbage

sebmarkbage commented Apr 11, 2020

Copy link
Copy Markdown
Contributor Author

Ok, this turned out to be a bit more code than I had originally hoped. I think we can still shave some bytes off from this implementation but it's still reasonable and much better than people adding meta data to code like displayName or line numbers since that doesn't scale.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@sebmarkbage sebmarkbage changed the title Fix Component Stacks for Native Classes in Safari Fix Component Stacks for IE and Native Classes in Safari Apr 11, 2020
sebmarkbage added 2 commits April 10, 2020 19:21
@sebmarkbage
Protect against generating stacks failing
8a7097f
Errors while generating stacks will bubble to the root. Since this technique
is a bit sketchy, we should probably protect against it.
@sebmarkbage
Don't construct the thing that throws
5007c88
Instead, we pass the prototype as the "this". It's new every time anyway.
@sebmarkbage
sebmarkbage force-pushed the proderrorstacks branch from 28d7c0a to 5007c88 Compare April 11, 2020 02:21
@sebmarkbage
sebmarkbage merged commit 72d00ab into react:master Apr 11, 2020
@bvaughn

bvaughn commented Apr 11, 2020

Copy link
Copy Markdown
Contributor

Nice!

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@bvaughn bvaughn mentioned this pull request Apr 17, 2020
DevTools: Improved "native" component stacks #18656
Merged
mrizwanashiq pushed a commit to mrizwanashiq/react that referenced this pull request Jun 25, 2026
@sebmarkbage
Fix Component Stacks for IE and Native Classes in Safari (react#18575)
1848f04
* Add more edge cases to fixture

Also adjust some expectations. I think the column should ideally be 1 but varies.
The Example row is one line off because it throws on the hook but should ideally be the component.
Similarly class components with constructors may have the line in the constructor.

* Account for the construct call taking a stack frame

We do this by first searching for the first different frame, then find
the same frames and then find the first different frame again.

* Throw controls

Otherwise they don't get a stack frame associated with them in IE.

* Protect against generating stacks failing

Errors while generating stacks will bubble to the root. Since this technique
is a bit sketchy, we should probably protect against it.

* Don't construct the thing that throws

Instead, we pass the prototype as the "this". It's new every time anyway.
hanzo-dev pushed a commit to hanzoai/react that referenced this pull request Sep 9, 2026
@sebmarkbage
Fix Component Stacks for IE and Native Classes in Safari (react#18575)
0487ca3
* Add more edge cases to fixture

Also adjust some expectations. I think the column should ideally be 1 but varies.
The Example row is one line off because it throws on the hook but should ideally be the component.
Similarly class components with constructors may have the line in the constructor.

* Account for the construct call taking a stack frame

We do this by first searching for the first different frame, then find
the same frames and then find the first different frame again.

* Throw controls

Otherwise they don't get a stack frame associated with them in IE.

* Protect against generating stacks failing

Errors while generating stacks will bubble to the root. Since this technique
is a bit sketchy, we should probably protect against it.

* Don't construct the thing that throws

Instead, we pass the prototype as the "this". It's new every time anyway.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@gaearon gaearon gaearon approved these changes
@bvaughn bvaughn Awaiting requested review from bvaughn
@acdlite acdlite Awaiting requested review from acdlite

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

CLA Signed React Core Team Opened by a member of the React Core Team

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

5 participants

@sebmarkbage @sizebot @bvaughn @gaearon @facebook-github-bot
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.