Key error shows internal code frames
Nobody has claimed this yet.
- Dominant language
- C++
- Stars
- 127k
- Forks
- 25.3k
- Avg merge
- 1d 23h
- Merged PRs (30d)
- 4
Description
Description
In LogBox, when there's a key error from React, the code frame should point to the application code causing the issue, but in 0.73 (and maybe other versions) it points to the react-jsx-runtime:
The fix is to add '/node_modules/react/cjs/react-jsx-runtime.+\\.js', to the config here:
https://github.com/facebook/react-native/blob/main/packages/metro-config/index.js#L15
Really we should probably have all of '/node_modules/react/.+\\.js$', there.
Steps to reproduce
- trigger key error
- open logbox warning
- see wrong code frame
React Native Version
0.73.0
Affected Platforms
Runtime - Android, Runtime - iOS
Output of npx react-native info
No
Stacktrace or Logs
No
Reproducer
No
Screenshots and Videos
Above
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in packages/metro-config/index.js around line 15, where the code-frame configuration is defined. Reproduce the key error in LogBox and inspect which React runtime file is selected instead of the application source. Done means the warning points to the application code rather than an internal react-jsx-runtime file.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- react, react-native
- Domain
- mobile, tooling
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100