Skip to content

Conversation

DorianMazur
Copy link
Contributor

@DorianMazur DorianMazur commented Aug 21, 2025

Summary:

Replace JSON.stringify with stringifySafe in FuseboxReactDevToolsDispatcher to safely serialize messages that may contain circular refs. This prevents errors observed when some plugins (e.g., on rozenite.dev) emit circular structures and hardens the dispatcher for other callers.

Changelog:

[GENERAL] [FIXED] - Prevent errors when serializing messages with circular references in FuseboxReactDevToolsDispatcher by using stringifySafe.

Test Plan:

Repro before: use a plugin that emits a circular structure (e.g., via rozenite.dev) → app crashes with “Converting circular structure to JSON”.

After change: no crash; messages are delivered; receiving side still JSON.parses and emits as expected.

@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 21, 2025
@facebook-github-bot facebook-github-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 21, 2025
@DorianMazur
Copy link
Contributor Author

Related issue callstackincubator/rozenite#78

@huntie
Copy link
Member

huntie commented Aug 22, 2025

Hi @DorianMazur!

React Native DevTools currently has no support for custom plugin communication. My understanding is that Rozenite implements them by reaching into React Native’s internals in an unsupported way. To be clear, such access to internals (including, but not limited to FuseboxReactDevToolsDispatcher) may break at any point, and is not allowed by React Native’s API.

  • Phrased another way, you are piggybacking a specific binding meant exclusively for the "Components" and "Profiler" panels
  • Outside of Rozenite, this update to FuseboxReactDevToolsDispatcher is unnecessary and adds overhead that will likely slow down these features.

So unfortunately, this isn’t a PR we can accept.

Alternative approach

Looking narrowly at the problem you're solving in this PR - what's the benefit of using the private __FUSEBOX_REACT_DEVTOOLS_DISPATCHER__ hook, as opposed to building your own user-land mechanism for messages? For example, a separate, dedicated binding where you can support any kind of data structure needed for your use case.

Our stance on React Native DevTools extendability

Extensions support in RNDT is something we absolutely want to build towards (capacity willing in our team!). We appreciate the early steps made by Rozenite, however we cannot have these extensions compromise the core debugging experience in RNDT.

We don't want to block the ability for open source to build upon the React Native project, however these must use public extension points. And again, we're concerned about the current setup of Rozenite in some places.

Again we're grateful that a start has been made on extensions support, and we're keen to coalesce on a durable design. We are in communication(!), and will sync up at the Core Contributors Summit in September.

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.

3 participants