feat(core): Enable autoInjectSentryLabel by default in Metro config#6141
Open
antonis wants to merge 3 commits into
Open
feat(core): Enable autoInjectSentryLabel by default in Metro config#6141antonis wants to merge 3 commits into
antonis wants to merge 3 commits into
Conversation
Pass `autoInjectSentryLabel: true` to the babel-plugin-component-annotate plugin by default when `annotateReactComponents` is enabled. This enables automatic injection of `sentry-label` props from static text content at build time, improving touch breadcrumb and user interaction span labeling. Users can opt out by setting `autoInjectSentryLabel: false` in the `annotateReactComponents` config option. Closes #6109 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Contributor
Semver Impact of This PR⚪ None (no version bump detected) 📋 Changelog PreviewThis is how your changes will appear in the changelog.
🤖 This preview updates automatically when you update the PR. |
Contributor
|
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
✅ Bugbot reviewed your changes and found no new issues!
Comment @cursor review or bugbot run to trigger another review on this PR
Reviewed by Cursor Bugbot for commit c481082. Configure here.
10 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
📢 Type of change
📜 Description
Passes
autoInjectSentryLabel: trueto@sentry/babel-plugin-component-annotateby default whenannotateReactComponentsis enabled in the Metro config. This enables automatic injection ofsentry-labelprops from static text content at build time.The Babel plugin (shipped in
@sentry/babel-plugin-component-annotate@5.3.0, getsentry/sentry-javascript-bundler-plugins#925) extracts static text from children of touchable components and injects it as asentry-labelprop, improving touch breadcrumb and user interaction span labeling without requiring manual annotation.Users can opt out:
💡 Motivation and Context
Closes #6109. Part of the "Making breadcrumbs data more useful on React Native" project.
Currently, touch breadcrumbs show component names like "TouchableOpacity" unless developers manually add
sentry-label,accessibilityLabel, ortestIDprops. With this change, buttons like<Pressable><Text>Save workout</Text></Pressable>automatically get labeled "Save workout" in breadcrumbs and transaction names.💚 How did you test it?
yarn build— compiles without errorsnpx jest --config jest.config.tools.js test/tools/sentryBabelTransformer.test.ts— 8/8 passnpx jest --config jest.config.tools.js test/tools/metroconfig.test.ts— 142/142 passyarn lint— no violationsyarn api-report— API report up to dateautoInjectSentryLabel: falseoverrideautoInjectSentryLabel: trueis passed by default📝 Checklist
sendDefaultPIIis enabled🔮 Next steps
🤖 Generated with Claude Code