Skip to content
This repository was archived by the owner on Jun 26, 2020. It is now read-only.
This repository was archived by the owner on Jun 26, 2020. It is now read-only.

[React Native] Devtools can't find React within the Web Worker (help wanted) #229

Closed
@ide

Description

@ide

Update from Maintainers: DevTools works with React Native again! Follow these instructions: http://facebook.github.io/react-native/docs/debugging.html#react-developer-tools

React Native now runs within a Web Worker on Chrome so that it gets a more pure and isolated JS environment that more closely mimics JSC on the device but this breaks the React devtools. @skevy pointed this out and I didn't see a task open yet. The fix might need to happen on the RN side but I figured that people thinking about the devtools are more likely to have a solution come to mind.

Repro: Run an app with RN master, run it in the Chrome debugger, try to use React devtools but "React" option doesn't show in the Web Inspector.

Activity

sophiebits

sophiebits commented on Sep 26, 2015

@sophiebits
Contributor

I don't know how to fix this. I now remember that this is why we didn't merge that RN pull request originally.

jaredly

jaredly commented on Sep 26, 2015

@jaredly
Contributor

There's a way to do it, but I imagine it will slow things down more. I'll
investigate

On 4:41PM, Sat, Sep 26, 2015 Ben Alpert notifications@github.com wrote:

I don't know how to fix this. I now remember that this is why we didn't
merge that RN pull request originally.


Reply to this email directly or view it on GitHub
#229 (comment)
.

sebmarkbage

sebmarkbage commented on Oct 7, 2015

@sebmarkbage
Contributor

@jaredly Why would it slow things down? It is already an async bridge and potentially we could communicate directly from the Worker to the Dev Tools. It'd be good to have multiple host support for multiple Workers and iframes regardless.

jaredly

jaredly commented on Oct 7, 2015

@jaredly
Contributor

Multiple hosts is a good point.
It would slow things down b/c it's yet another hoop to jump through. I'll go ahead an implement it and we'll see.

jaredly

jaredly commented on Oct 7, 2015

@jaredly
Contributor

:/ looks like there's no way to go from webworker to devtools from the apis. You can eval in an iframe's context, but not in a worker. Looks like we'll have to route everything through the main page's context.

ksheedlo

ksheedlo commented on Oct 9, 2015

@ksheedlo

This needs to be fixed. @jaredly have you made any progress?

sulliwane

sulliwane commented on Oct 13, 2015

@sulliwane

Is it related to my problem: the react tab won't show up in Chrome with RN 0.12? (for an RN app running in the simulator, and websocket connection well established)

ide

ide commented on Oct 13, 2015

@ide
Author

Yes, the devtools currently do not work with RN.

tomkur

tomkur commented on Oct 13, 2015

@tomkur

👍

yrokhlin

yrokhlin commented on Oct 14, 2015

@yrokhlin

+1 to this, it's quiet possibly the most annoying thing ever.

rreusser

rreusser commented on Oct 14, 2015

@rreusser

This sounds like also perhaps the reason window is now inaccessible in the console. I know that's a dirty, ugly way to debug, but it was really convenient. +1 for optional, but I know there are certainly more relevant things going on here.

mschipperheyn

mschipperheyn commented on Oct 14, 2015

@mschipperheyn

It's pretty major. Wouldn't it make sense to roll the chrome debugging related changes back and reimplement when the overall issue is fixed?

104 remaining items

gaearon

gaearon commented on Feb 15, 2017

@gaearon
Contributor

To debug RN today, use the standalone DevTools package.
There are still some flakiness issues with stable RN build, but RN master works really well with it.

dariocravero

dariocravero commented on Feb 25, 2017

@dariocravero

@gaearon is there any way to debug the standalone devtools when the it gets stuck on "Connecting to React..."? Thanks :)

gaearon

gaearon commented on Feb 25, 2017

@gaearon
Contributor

You can try to apply these changes locally:

facebook/react-native@7a3ab96
facebook/react-native@934cd82

They fix the flakiness due to race conditions in existing code. When they're in a stable RN release, everything should be good out of the box.

As I said in the comment above:

There are still some flakiness issues with stable RN build, but RN master works really well with it.

dariocravero

dariocravero commented on Feb 25, 2017

@dariocravero

Perfect! Will give that a go now, thanks again :)

gaearon

gaearon commented on Feb 25, 2017

@gaearon
Contributor

Let me know if it helps! (I hope it should.)

dariocravero

dariocravero commented on Feb 25, 2017

@dariocravero

@gaearon, here's an update on this, it seems that it wasn't a problem with the packages that are published on npm but instead an conflict with Debug JS Remotely. If that option is enabled, the devtools get stuck in the connecting message. If I disable it, after reloading both, the simulator and the devtools it works alright :).
Are the devtools intended to be used on their own without the extra JS remote debugging? Or might this be hinting a bug? Thanks!

cwagner22

cwagner22 commented on Feb 25, 2017

@cwagner22

Just leaving that here: https://github.com/jhen0409/react-native-debugger
You can use it to debug react-native (with devtools), it might help the ones like me who are just starting...

gaearon

gaearon commented on Feb 25, 2017

@gaearon
Contributor

@cwagner22 This package has a few extra tools but it uses exactly the same code underneath.

@dariocravero Do you mind sending a PR to package README explaining this? I don't know anything about the "Debug JS Remotely" option—first time hearing about it. So yes, I never tested with it, and maybe it won't work. If you could explain what exactly it is doing maybe we can figure it out. Thanks!

jhen0409

jhen0409 commented on Feb 26, 2017

@jhen0409
Contributor

here's an update on this, it seems that it wasn't a problem with the packages that are published on npm but instead an conflict with Debug JS Remotely. If that option is enabled, the devtools get stuck in the connecting message. If I disable it, after reloading both, the simulator and the devtools it works alright :).
Are the devtools intended to be used on their own without the extra JS remote debugging? Or might this be hinting a bug? Thanks!

@dariocravero I guess the problem the same with #476 (comment), we should ensure requestIdleCallback works with Debug JS Remotely, maybe just sync time between host and simulator/device. (I have received the same issue at jhen0409/react-native-debugger#45)

gaearon

gaearon commented on Feb 26, 2017

@gaearon
Contributor

This is interesting. Can you please file an issue in this repo so I could take a look?

gaearon

gaearon commented on Jun 9, 2017

@gaearon
Contributor

Using React DevTools in React Native is now officially documented:
http://facebook.github.io/react-native/docs/debugging.html#react-developer-tools

I'll lock this issue. If you have any further problems please file new issues.

locked and limited conversation to collaborators on Jun 9, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

    Development

    No branches or pull requests

      Participants

      @sophiebits@mbrock@kassens@sebmarkbage@zires

      Issue actions

        [React Native] Devtools can't find React within the Web Worker (help wanted) · Issue #229 · facebook/react-devtools