You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[DevTools Bug]: When inspecting with DevTools, it fails to select correct react component when there are multiple react-dom instances in the application
#24539
Closed
danielkutt opened this issue
May 11, 2022
· 0 comments
· Fixed by #24665
… node (#30494)
Stacked on #30491.
When going from DOM Node to select a component or highlight a component
we find the nearest mounted ancestor. However, when multiple renderers
are nested there can be multiple ancestors. The original fix#24665 did
this by taking the inner renderer if it was an exact match but if it
wasn't it just took the first renderer.
Instead, we can track the inner most node we've found so far. Then get
the ID from that node (which will be fast since it's now a perfect
match). This is a better match.
However, the main reason I'm doing this is because the old mechanism
leaked the `Fiber` type outside the `RendererInterface` which is
supposed to abstract all of that. With the new algorithm this doesn't
leak.
I've tested this with a new build against the repro in the old issue
#24539 and it seems to work.
Website or app
https://codesandbox.io/s/jtiw8m
Repro steps
When using devtools in the linked codesandbox, I am not able to select react components that are rendered by the micro-fe using the inspect tool.
Steps to reproduce:
App
as the component (or if the component type filter is disabled, it selects thediv
where the micro-fe is mounted)Ideally it would actually select either the
MicroFeRoot
component (or the corresponding html node if the filter is disabled).I was able to get it working by doing the following change in the
react-devtools-backend/src/backend/agent.js
How often does this bug happen?
Every time
DevTools package (automated)
No response
DevTools version (automated)
No response
Error message (automated)
No response
Error call stack (automated)
No response
Error component stack (automated)
No response
GitHub query string (automated)
No response
The text was updated successfully, but these errors were encountered: