Skip to content

[FIX] [V2] Babel plugin crash when handling unresolved component names#1211

Merged
cdn34dd merged 1 commit intofeature/v2from
carlosnogueira/issue-1209/fix-unknown-identifier-v2
Mar 19, 2026
Merged

[FIX] [V2] Babel plugin crash when handling unresolved component names#1211
cdn34dd merged 1 commit intofeature/v2from
carlosnogueira/issue-1209/fix-unknown-identifier-v2

Conversation

@cdn34dd
Copy link
Contributor

@cdn34dd cdn34dd commented Mar 17, 2026

What does this PR do?

FIxes invalid JSX generated when handling component names that can't be resolved.

Motivation

Issue 1209

Review checklist (to be filled by reviewers)

  • Feature or bugfix MUST have appropriate tests
  • Make sure you discussed the feature or bugfix with the maintaining team in an Issue
  • Make sure each commit and the PR mention the Issue number (cf the CONTRIBUTING doc)
  • If this PR is auto-generated, please make sure also to manually update the code related to the change

@cdn34dd cdn34dd requested a review from a team as a code owner March 17, 2026 18:46
Copilot AI review requested due to automatic review settings March 17, 2026 18:46
@cdn34dd cdn34dd changed the title Fix Babel plugin crash when handling unresolved component names [FIX] [V2] Babel plugin crash when handling unresolved component names Mar 17, 2026
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes invalid JSX output produced by the React Native Babel plugin when a component name cannot be resolved, preventing crashes and ensuring generated code remains valid.

Changes:

  • Update RUM JSX runtime call generation to use Fragment when the component name can’t be resolved.
  • Add a regression test ensuring unresolved component names don’t emit (unknown, ...) and instead reference Fragment.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
packages/react-native-babel-plugin/src/actions/rum/index.ts Uses Fragment from react/jsx-runtime as a safe fallback when no element name can be derived.
packages/react-native-babel-plugin/test/plugin.test.ts Adds a regression test covering unresolved component name handling in getContent.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@marco-saia-datadog marco-saia-datadog left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good but refer to #1210 (review)

- Add support for JSXMemberExpression in getNodeName function
@cdn34dd cdn34dd force-pushed the carlosnogueira/issue-1209/fix-unknown-identifier-v2 branch from 6841f94 to 2582b37 Compare March 19, 2026 14:05
@cdn34dd cdn34dd merged commit 55577aa into feature/v2 Mar 19, 2026
9 checks passed
@cdn34dd cdn34dd deleted the carlosnogueira/issue-1209/fix-unknown-identifier-v2 branch March 19, 2026 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants