Skip to content

Run codegen for formatted native component calls - #58257

Open
OskarEichler wants to merge 1 commit into
react:mainfrom
OskarEichler:codex/detect-formatted-codegen-native-component
Open

Run codegen for formatted native component calls#58257
OskarEichler wants to merge 1 commit into
react:mainfrom
OskarEichler:codex/detect-formatted-codegen-native-component

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary:

The source-optimized preset enables native component codegen only when codegenNativeComponent is immediately followed by <. Valid Flow syntax permits comments or whitespace before the type arguments, so codegenNativeComponent /* comment */ <NativeProps>(...) bypasses codegen and emits an ordinary runtime call instead of the generated __INTERNAL_VIEW_CONFIG produced by the full preset path.

Use the stable codegenNativeComponent identifier token as the cheap source prefilter while retaining the existing null/undefined full-scan path. Formatting no longer changes build output; false-positive tokens only enable the codegen visitor, which remains a no-op without a matching call.

Changelog:

[GENERAL] [FIXED] - Run native component codegen when Flow type arguments are separated by trivia.

Test Plan:

  • Added a valid Flow native-component spec containing a comment before <NativeProps>.
  • Exact optimized baseline emits the ordinary call without __INTERNAL_VIEW_CONFIG; the fixed transform generates the static view config.
  • Full preset Jest passes: 4/4 suites, 111/111 tests, 16 snapshots.
  • Fresh Flow check reports 0 errors.
  • Targeted no-ignore ESLint, Prettier, and git diff --check pass.

No public API or breaking behavior change; optimized and full preset paths now agree for valid formatting.

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Aug 31, 2026
@facebook-github-tools facebook-github-tools Bot added the Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team. label Aug 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Shared with Meta Applied via automation to indicate that an Issue or Pull Request has been shared with the team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant