Comments (10)
This is interesting. I can't repro it in a test app created to try to trigger it:
https://tj8xl.csb.app/
All ways of selecting one of the rows (the selector tool, right click + "inspect", scroll and click in Elements tab) successfully sync up with the DevTools Components tab.
from react-devtools-experimental.
I can if I add a second React root. I think that might be the cause somehow.
Update: I could for a little while and now I can't again 😁
from react-devtools-experimental.
The flow of code for this feature is...
-
DevTools backend listens for a new selection in the browser's Elements tab and sets a flag (
needsToSyncElementSelection
):
react-devtools-experimental/shells/browser/shared/src/main.js
Lines 213 to 216 in 8001b64
-
Right before the Components tab is shown again, if this flag has been marked, it notifies the UI to update the selection:
react-devtools-experimental/shells/browser/shared/src/main.js
Lines 221 to 226 in 8001b64
-
The
Agent
in the middle listens for this:
react-devtools-experimental/src/backend/agent.js
Lines 345 to 351 in 8001b64
-
And forwards it on to the frontend:
react-devtools-experimental/src/backend/agent.js
Lines 319 to 324 in 8001b64
-
The frontend listens for this and updates its state:
react-devtools-experimental/src/devtools/views/Components/TreeContext.js
Lines 710 to 716 in 8001b64
-
Lastly the
Tree
UI listens for a change in state, and triggers the scroll to:
react-devtools-experimental/src/devtools/views/Components/Tree.js
Lines 66 to 76 in 8001b64
Looks like all of these things are working as expected (in that the selection is being updated) except for the scroll operation. It works some (most?) of the time but not always.
Maybe this could indicate that, in some cases, the DevTools panel (and the tree/list inside of it) has an initial height of 0 or something?
from react-devtools-experimental.
If I force a height of 0, (by opening the bottom pop-out console so it completely covers DevTools), I can force this to happen.
from react-devtools-experimental.
Maybe this could indicate that, in some cases, the DevTools panel (and the tree/list inside of it) has an initial height of 0 or something?
Yeah, I think for sure this is what's happening. AutoSizer
bails out rendering its children when it has a height of 0:
https://github.com/bvaughn/react-virtualized-auto-sizer/blob/ffcba2dd39b89111ed4b42d64431f35ce7c1c23a/src/index.js#L121-L150
So what's happening is that the effect that should trigger the scroll gets run:
react-devtools-experimental/src/devtools/views/Components/Tree.js
Lines 66 to 76 in 8001b64
But at that time, the list ref is null. Once it's later set, the effect doesn't get re-run, because it's a ref.
from react-devtools-experimental.
I think the fix to this would just be to set a min-height
for the wrapper component to ensure that the AutoSizer
bailout never happens in this case.
Alternately I guess I could go with a callback ref for this. Maybe that's a less hacky way to do this.
from react-devtools-experimental.
Based on my own testing, with a more contrived scenario, this fixes the issue. Hopefully it will fix it for you too but if not we'll revisit. For now I'll land a fix and see if you can confirm :)
from react-devtools-experimental.
Fixed via 8fa608d~
from react-devtools-experimental.
Thanks for looking into it!! :D
Will our internal FB version auto-update or do I need to manually install the update?
from react-devtools-experimental.
Will our internal FB version auto-update
Yes, assuming you've got the Chef-installed version (by being a member in the v4 Workplace group). If you've manually installed though, you'll need to manually update
from react-devtools-experimental.
Related Issues (20)
- Truncation of key prop in GUI HOT 1
- Improve HOC search UX HOT 1
- Profiling does not work in Chrome HOT 4
- Improve globaly state/props edition. HOT 3
- Don't show "context" for classes without either contextType or contextTypes HOT 9
- Potential issue when using typescript. HOT 3
- node type filtering HOT 4
- Some memo components displaying as Anonymous HOT 6
- Hook names grabbing solution w/o changing api HOT 1
- Inspecting complex values HOT 5
- feat: support search by prop, state, hooks HOT 1
- Style editor doesn't support single quotes for string values HOT 2
- The Context hook is not shown unless another hook is also presen like useState or useEffect HOT 7
- can not edit state with version `2f1c100` HOT 2
- Document/allow custom panel/extensions HOT 1
- Occasional FOUC when loading DevTools HOT 1
- Tooltips appear to be Times New Roman in Firefox HOT 2
- An easier way to see all siblings HOT 1
- Fully disable 0.14 support HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-devtools-experimental.