-
Notifications
You must be signed in to change notification settings - Fork 905
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add more internal callsites for better stack frames #1699
Add more internal callsites for better stack frames #1699
Conversation
cc @motiz88 @huntie, mind reviewing that? |
I'm not sure where the string I would also not collapse all |
@@ -14,9 +14,14 @@ const INTERNAL_CALLSITES_REGEX = new RegExp( | |||
'/Libraries/YellowBox/.+\\.js$', | |||
'/Libraries/LogBox/.+\\.js$', | |||
'/Libraries/Core/Timers/.+\\.js$', | |||
'/Libraries/WebSocket/.+\\.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'/Libraries/WebSocket/.+\\.js', | |
'/Libraries/WebSocket/.+\\.js$', |
@@ -14,9 +14,14 @@ const INTERNAL_CALLSITES_REGEX = new RegExp( | |||
'/Libraries/YellowBox/.+\\.js$', | |||
'/Libraries/LogBox/.+\\.js$', | |||
'/Libraries/Core/Timers/.+\\.js$', | |||
'/Libraries/WebSocket/.+\\.js', | |||
'/Libraries/vendor/.+\\.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'/Libraries/vendor/.+\\.js', | |
'/Libraries/vendor/.+\\.js$', |
'/node_modules/react-devtools-core/.+\\.js$', | ||
'/node_modules/react-refresh/.+\\.js$', | ||
'/node_modules/scheduler/.+\\.js$', | ||
'/node_modules/event-target-shim/.+\\.js$', | ||
'/metro-runtime/.+\\.js$', | ||
'\\[native code\\]', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'\\[native code\\]', | |
'^\\[native code\\]$', |
I suspect this string may be engine-specific - have you tested this on both JSC and Hermes?
Also, bikeshedding: might be useful to include native code as intermediate frames, though I agree they're less useful at the top since we have no JS code frame to show there.
@@ -14,9 +14,14 @@ const INTERNAL_CALLSITES_REGEX = new RegExp( | |||
'/Libraries/YellowBox/.+\\.js$', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if all of these should be prefixed with react-native
. (Not sure)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah probably -- I opted to minimize the diff because I wasn't sure why it was this way.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@rickhanlonii mind following up with a PR with adjusted paths?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason the react-native
prefix is missing is because forks of React Native such as react-native-tvos
(and react-native-windows
?) have copies of these files but are installed within node_modules
using their forked name. If you match on react-native
, you'll break YellowBox
for all forks. You might want to use node_modules\/(react-native(?:-(.*?))?)\/
here and below where you added the match on /node_modules/react-native/index.js
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A wild Nakazawa appears!
Christoph used Context.
It's super effective!
I might be missing something but how does the |
Nice catch, I missed this copying it over. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @rickhanlonii and @motiz88
Summary: In 2017, React published v15.5 which extracted the built-in `prop types` to a separate package to reflect the fact that not everybody uses them. In 2018, React Native started to remove `PropTypes` from React Native for the same reason. In 0.68 React Native introduced a deprecation warning which notified users that the change was coming, and in 0.69 we removed the PropTypes entirely. The feedback we've received from the community is that there has not been enough time to migrate libraries off of PropTypes. This has resulted in users needing to patch the React Native package `index.js` file directly to add back the PropTypes, instead of migrating off of them. We can empathize with this fix short term (it unblocks the upgrade) but long term this patch will cause users to miss important changes to `index.js`, and add a maintenance cost for users. Part of the reason there was not enough time is that we didn't do a good job surfacing libraries that were using PropTypes. This means, when you got a deprecation warning, it wasn't clear where the source of the usage was (either in your code or in a library). So even if you wanted to migrate, it was difficult to know where to actually make the change. In the next release, we've made it easier to find call sites using deprecated types by [fixing the code frame in errors](react-native-community/cli#1699) reporting in LogBox, and ensuring that [the app doesn't crash without a warning](#34650). This should make it easier to identify exactly where the deprecated usage is, so you can migrate it. To help users get off of the patch, and allow more time to migrate, we're walking back the removal of PropTypes, and keeping it as a deprecation for a couple more versions. We ask that you either migrate off PropTypes to a type system like TypeScript, or migrate to the `deprecated-react-native-prop-types` package. Once we feel more confident that the community has migrated and will not need to patch React Native in order to fix this issue, we'll remove the PropTypes again. **If you have any trouble finding the source of the PropType usage, please file an issue so we can help track it down with you.** Changelog: [General][Changed] - Add back deprecated PropTypes Reviewed By: yungsters Differential Revision: D40725705 fbshipit-source-id: 8ce61be30343827efd6dc89a012eeef0b6676deb
Summary: In 2017, React published v15.5 which extracted the built-in `prop types` to a separate package to reflect the fact that not everybody uses them. In 2018, React Native started to remove `PropTypes` from React Native for the same reason. In 0.68 React Native introduced a deprecation warning which notified users that the change was coming, and in 0.69 we removed the PropTypes entirely. The feedback we've received from the community is that there has not been enough time to migrate libraries off of PropTypes. This has resulted in users needing to patch the React Native package `index.js` file directly to add back the PropTypes, instead of migrating off of them. We can empathize with this fix short term (it unblocks the upgrade) but long term this patch will cause users to miss important changes to `index.js`, and add a maintenance cost for users. Part of the reason there was not enough time is that we didn't do a good job surfacing libraries that were using PropTypes. This means, when you got a deprecation warning, it wasn't clear where the source of the usage was (either in your code or in a library). So even if you wanted to migrate, it was difficult to know where to actually make the change. In the next release, we've made it easier to find call sites using deprecated types by [fixing the code frame in errors](react-native-community/cli#1699) reporting in LogBox, and ensuring that [the app doesn't crash without a warning](facebook#34650). This should make it easier to identify exactly where the deprecated usage is, so you can migrate it. To help users get off of the patch, and allow more time to migrate, we're walking back the removal of PropTypes, and keeping it as a deprecation for a couple more versions. We ask that you either migrate off PropTypes to a type system like TypeScript, or migrate to the `deprecated-react-native-prop-types` package. Once we feel more confident that the community has migrated and will not need to patch React Native in order to fix this issue, we'll remove the PropTypes again. **If you have any trouble finding the source of the PropType usage, please file an issue so we can help track it down with you.** Changelog: [General][Changed] - Add back deprecated PropTypes Reviewed By: yungsters Differential Revision: D40725705 fbshipit-source-id: 8ce61be30343827efd6dc89a012eeef0b6676deb
Summary:
Adds more internal callsites to clean up log box internal stack frame collapsing.
Test Plan:
Before
Notice how the code frame is not the error in the user code:
After
Now it is: