react-devtools icon indicating copy to clipboard operation
react-devtools copied to clipboard

Devtools highlight node even if it was not updated

Open rmuratov opened this issue 7 years ago • 5 comments

Here's the repo with test project.

Counter component updates when clicking. It's highlighted as expected. But Title is a pure component but still highlighted. The thing is I placed the same Title below and it's not highlighted as it should. Then I placed AddButton above everything and now the top button is highlighted, but similar button at the bottom is not.

test1 test2

rmuratov avatar Dec 26 '18 08:12 rmuratov

Same problem with react-redux v6

00050 avatar Jan 29 '19 10:01 00050

The way the highlighting seems to work is that it paints a border around the component setState/forcUpdate (and the direct children) it was called on. In the linked example this is the App component which has to traverse down the tree and check if each component needs to be updated. In other words: it doesn't reflect actual mutations to the DOM, but rather the children that need to be checked.

Moving the state into the Counter component fixes this and just draws a box around Counter as one would expect.

marvinhagemeister avatar Jan 31 '19 15:01 marvinhagemeister

@marvinhagemeister Did you notice the top button on the second gif? It is being highlighted. I'm not talking about DOM, but what it says to developer this highlighted button which is pure component and doesn't rely on state? I understand that this button is a child of stateful component whose state changes over time, but what about this button's siblings, two Titles? Why they are not highlighted? I admit that I could understand something wrong, but this behavior is confusing.

rmuratov avatar Jan 31 '19 19:01 rmuratov

@rmuratov You're right, I somehow missed the first title. That looks indeed like a bug :+1:

marvinhagemeister avatar Jan 31 '19 20:01 marvinhagemeister

React DevTools has been rewritten and recently launched a new version 4 UI. The source code for this rewrite was done in a separate repository and now lives in the main React repo (github.com/facebook/react).

Because version 4 was a total rewrite, and all issues in this repository are related to the old version 3 of the extension, I am closing all issues in this repository. If you can still reproduce this issue, or believe this feature request is still relevant, please open a new issue in the React repo: https://github.com/facebook/react/issues/new?labels=Component:%20Developer%20Tools

bvaughn avatar Aug 19 '19 23:08 bvaughn