Skip to content

Babel plugin: preserve optional handlers (#1509) - #1524

Open
cdn34dd wants to merge 1 commit into
developfrom
fix/1509-preserve-optional-handlers
Open

cdn34dd wants to merge 1 commit into
developfrom
fix/1509-preserve-optional-handlers

Conversation

@cdn34dd

@cdn34dd cdn34dd commented Oct 30, 2026

Copy link
Copy Markdown
Collaborator

What does this PR do?

Preserves undefined and null handler props when applying Babel RUM instrumentation. Referenced handlers are evaluated once and wrapped only when present.

This restores Pressable behavior: when no onLongPress handler is provided, holding and releasing still triggers onPress.

Fixes #1509.

Motivation

The plugin previously replaced absent handlers with wrapper functions. React Native treated the generated onLongPress wrapper as a defined handler and suppressed onPress after the long-press threshold, silently dropping button presses.

Additional Notes

  • Added regression coverage using React Native’s actual Pressability state machine, covering absent and defined handlers with and without tracking.
  • Added a manual reproduction in example-new-architecture with visible press counters.
  • Validated 307 tests, the plugin build, and the example’s TypeScript checks.

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 October 30, 2026 16:13
Copilot AI balanced review requested due to automatic review settings October 30, 2026 16:13
@datadog-prod-us1-5

datadog-prod-us1-5 Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Pipelines  Tests

🎉 All green!

🧪 All tests passed
❄️ No new flaky tests detected

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 106c799 | Docs | View more details | Give us feedback!

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 30, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-30T16:30:34.288970Z 106c799 New commits
🔒 Security Review ✅ Completed 2026-10-30T16:31:44.191960Z 106c799 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

This comment was marked as outdated.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 04c8796616

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

datadog-prod-us1-5[bot]

This comment was marked as outdated.

Copilot AI balanced review requested due to automatic review settings October 30, 2026 16:18
@cdn34dd
cdn34dd force-pushed the fix/1509-preserve-optional-handlers branch from 04c8796 to c3abd77 Compare October 30, 2026 16:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟢 Approval recommended

No active review issues were identified for the instrumentation changes that preserve nullish handler props.

No open issues 🎉

1 resolved since last review

Review effort: Balanced

@cdn34dd
cdn34dd force-pushed the fix/1509-preserve-optional-handlers branch from c3abd77 to 106c799 Compare October 30, 2026 16:28

This branch has not been deployed

No deployments
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.

Babel plugin: an undefined onLongPress becomes a function, so Pressable drops onPress after a long press

2 participants