File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed
packages/react-devtools-shared/src/devtools/views/Components Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -56,7 +56,10 @@ export function InspectedElementContextController({children}: Props) {
5656
5757 const refresh = useCacheRefresh ( ) ;
5858
59- // Track the paths insepected for the currently selected element.
59+ // Temporarily stores most recently-inspected (hydrated) path.
60+ // The transition that updates this causes the component to re-render and ask the cache->backend for the new path.
61+ // When a path is sent along with an "inspectElement" request,
62+ // the backend knows to send its dehydrated data even if the element hasn't updated since the last request.
6063 const [ state , setState ] = useState < { |
6164 element : Element | null ,
6265 path : Array < number | string > | null ,
@@ -97,7 +100,8 @@ export function InspectedElementContextController({children}: Props) {
97100 [ setState , state ] ,
98101 ) ;
99102
100- // Reset path
103+ // Reset path now that we've asked the backend to hydrate it.
104+ // The backend is stateful, so we don't need to remember this path the next time we inspect.
101105 useEffect ( ( ) => {
102106 if ( state . path !== null ) {
103107 setState ( {
You can’t perform that action at this time.
0 commit comments