Skip to content

Fix React DevTools messages containing escaped characters - #291

Merged
huntie merged 1 commit into
mainfrom
fix-react-devtools-message-escaping
Nov 9, 2026
Merged

huntie merged 1 commit into
mainfrom
fix-react-devtools-message-escaping

Conversation

@huntie

@huntie huntie commented Nov 9, 2026

Copy link
Copy Markdown
Collaborator

Summary

React DevTools messages reach the app through a Runtime.evaluate expression that wraps their JSON in a single-quoted string without escaping it. A message containing an escape such as \" arrives as invalid JSON, and one containing ' fails to evaluate, so the backend drops it and the app logs "Error while trying to send a message to domain react-devtools" to LogBox. Selecting a named boundary in the Suspense panel sends such a message on every click.

  • Embed both arguments as JSON string literals.

Test Plan

Ran RNTester on an iOS simulator with the Suspense panel from #290, watching the app's console over CDP while selecting the Feed and Comments boundaries.

  • Before: each selection logs Error while trying to send a message to domain react-devtools: SyntaxError: JSON Parse error: Unexpected character: F (C for Comments), shown as a LogBox toast.
  • After: ✅ No errors for the same selections, and no LogBox toast.

@huntie
huntie requested review from motiz88 and vzaidman November 9, 2026 14:55
@meta-cla meta-cla Bot added the cla signed label Nov 9, 2026
@huntie
huntie merged commit 441de1f into main Nov 9, 2026
5 checks passed
@huntie
huntie deleted the fix-react-devtools-message-escaping branch November 9, 2026 20:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants