Skip to content

Commit 2c30ebc

Browse files
authored
[DevTools] Update inspected element on component filter changes (facebook#35599)
1 parent a056625 commit 2c30ebc

File tree

1 file changed

+9
-0
lines changed
  • packages/react-devtools-shared/src/backend

1 file changed

+9
-0
lines changed

packages/react-devtools-shared/src/backend/agent.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1086,6 +1086,15 @@ export default class Agent extends EventEmitter<{
10861086
}
10871087
renderer.updateComponentFilters(componentFilters);
10881088
}
1089+
1090+
// Due to the component filters changing, we might be able
1091+
// to select a closer match for the currently selected host element.
1092+
// The store will already select a suitable parent if the the current
1093+
// selection is now filtered out in which cases this will be a no-op.
1094+
const target = window.__REACT_DEVTOOLS_GLOBAL_HOOK__.$0;
1095+
if (target != null) {
1096+
this.selectNode(target);
1097+
}
10891098
};
10901099

10911100
getEnvironmentNames: () => void = () => {

0 commit comments

Comments
 (0)