@samitouri / QOS-React-2 / commits / 2c30ebc4e3

[DevTools] Update inspected element on component filter changes (#35599)

Sebastian "Sebbie" Silbermann committed Jan 26, 2026 at 11:04 UTC 2c30ebc4e397d57fe75f850e32aa44e353052944
1 file changed +9
packages/react-devtools-shared/src/backend/agent.js
+9
@@ -1086,6 +1086,15 @@ export default class Agent extends EventEmitter<{
1086 }
1087 renderer.updateComponentFilters(componentFilters);
1088 }
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 + }
1098 };
1099
1100 getEnvironmentNames: () => void = () => {