Description
Problem
React Native's unhandled promise rejection handler has a hardcoded 2-second delay before onUnhandled fires. This causes a significant UX problem: users wait 2 seconds before seeing any error feedback.
Root Cause
This is not a Hermes issue - it's in the promise npm package that React Native uses for rejection tracking.
From promise/src/rejection-tracking.js:
setTimeout(
onUnhandled.bind(null, promise._rejectionId),
matchWhitelist(err, DEFAULT_WHITELIST) ? 100 : 2000
)
- 100ms for ReferenceError, TypeError, RangeError (programmer bugs)
- 2000ms for everything else (to allow late
.catch() attachments)
From the npm docs:
"To reduce the chance of false-positives there is a delay of up to 2 seconds before errors are logged."
Impact
Most app errors (network failures, API errors, business logic) get the 2-second delay, not the 100ms path. This makes error handling feel sluggish.
Suggested Improvement
Consider:
- Making the delay configurable via options
- Reducing the default delay (2s feels excessive in 2025)
- Documenting this behavior prominently (it's buried in the npm readme)
Workaround
Intercept errors before they become "unhandled rejections." For example, tRPC's MutationCache.onError or similar framework-level hooks fire immediately.
References
Steps to reproduce
see above
React Native Version
latest
Affected Platforms
Runtime - iOS
Output of npx @react-native-community/cli info
Stacktrace or Logs
MANDATORY Reproducer
n/a
Screenshots and Videos
No response
Description
Problem
React Native's unhandled promise rejection handler has a hardcoded 2-second delay before
onUnhandledfires. This causes a significant UX problem: users wait 2 seconds before seeing any error feedback.Root Cause
This is not a Hermes issue - it's in the
promisenpm package that React Native uses for rejection tracking.From
promise/src/rejection-tracking.js:.catch()attachments)From the npm docs:
Impact
Most app errors (network failures, API errors, business logic) get the 2-second delay, not the 100ms path. This makes error handling feel sluggish.
Suggested Improvement
Consider:
Workaround
Intercept errors before they become "unhandled rejections." For example, tRPC's
MutationCache.onErroror similar framework-level hooks fire immediately.References
Steps to reproduce
see above
React Native Version
latest
Affected Platforms
Runtime - iOS
Output of
npx @react-native-community/cli infoStacktrace or Logs
MANDATORY Reproducer
n/a
Screenshots and Videos
No response