Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

React DevTools Show Source is not working #196

Closed
simongong opened this issue Sep 16, 2015 · 15 comments
Closed

React DevTools Show Source is not working #196

simongong opened this issue Sep 16, 2015 · 15 comments

Comments

@simongong
Copy link

I tried to view source of component in React Panel

63cf1e54-bb59-4605-af03-4f8683ac69cd

But it ended up with somewhere in makeAssimilatePrototype.js

module.exports = function makeAssimilatePrototype() {
  var storedPrototype,
      knownPrototypes = [];

  function wrapMethod(key) {
    return function () {
      if (storedPrototype[key]) {
        return storedPrototype[key].apply(this, arguments);
      }
    };
  }
@gaearon
Copy link
Owner

gaearon commented Sep 16, 2015

@jaredly, is there any way I can tell React DevTools to look at a different function? Right now it points to the proxied method, but I can set something like __originalMethod on the proxy if we can come up with a convention you're happy with.

@jaredly
Copy link

jaredly commented Sep 18, 2015

Yeah, that sounds reasonable. Here's the code for jumping to a function's source (it uses the chrome console api fn inspect that jumps you to any function's source).
If it's an es6 class then I jump to the constructor, otherwise I jump to the render fn.

I imagine the constructor doesn't get proxied, right? So the only change would be for the render function?

@gaearon
Copy link
Owner

gaearon commented Sep 22, 2015

@jaredly The constructor is proxied too. Never mind React Hot Loader though—it's deprecated and the new proxying mechanism is in React Proxy. I'm proxying both constructor and all prototype methods there.

@gaearon gaearon added this to the v3.x milestone Apr 18, 2016
@gaearon
Copy link
Owner

gaearon commented Apr 19, 2016

I can’t repro this with React Hot Loader 3 so it somehow got fixed.
¯_(ツ)_/¯

@gaearon gaearon closed this as completed Apr 19, 2016
@Bnaya
Copy link
Contributor

Bnaya commented Nov 4, 2018

I'm having this issue on v4.3.12 and i think with all 4.x
/cc @theKashey

@theKashey
Copy link
Collaborator

Yeah, lets reopen this.
facebook/react-devtools#1191

@theKashey theKashey reopened this Nov 4, 2018
@theKashey
Copy link
Collaborator

Fixed in 4.5.0 (beta) - https://github.com/gaearon/react-hot-loader#setconfigconfig

@Bnaya
Copy link
Contributor

Bnaya commented Jan 11, 2019

@theKashey Thanks!
Which config should make it work?
what i have:
alias: isHot ? { "react-dom": "@hot-loader/react-dom" } : {},
and i have the console message that its up and runnint.

And:

import { setConfig } from "react-hot-loader";

// https://github.com/gaearon/react-hot-loader#setconfigconfig
setConfig({
  logLevel: "warning",
});

And the babel transformer plugin:

      plugins: isHot ? ["react-hot-loader/babel"] : [],
react-hot-loader@^4.6.3:
  version "4.6.3"

@theKashey
Copy link
Collaborator

@Bnaya - you need setConfig({pureRender: true});

@Bnaya
Copy link
Contributor

Bnaya commented Jan 17, 2019

I tried to understand what that means, and how it will effect me and i didn't manage to understand :(

@theKashey
Copy link
Collaborator

@Bnaya - https://github.com/gaearon/react-hot-loader#-hot-labs-

import { setConfig } from 'react-hot-loader'

setConfig({
  pureRender: true, // RHL will not change render method
})

@Bnaya
Copy link
Contributor

Bnaya commented Jan 17, 2019

i read the docs, but i just don't know what that means
if there will be a minimal example of what it do will be great

@theKashey
Copy link
Collaborator

The problem with DevTools was in shadowing .render, and the option you yet have to manually enable - the solution.

@Bnaya
Copy link
Contributor

Bnaya commented Jan 17, 2019

yes, but why its not on by default?
What is the effect on RHMR?

@theKashey
Copy link
Collaborator

It was an experimental option. There are a few tests, which goes red with this option enabled.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants