From c5ca597aeb41e589bfc4df6bf1d1472376643dd3 Mon Sep 17 00:00:00 2001 From: hawkgs Date: Wed, 2 Apr 2025 13:33:28 +0300 Subject: [PATCH] refactor(devtools): switch to components tab whenever the inspector is used (#60694) Switch to the components tab, if not there, when a component is selected via the inspector. PR Close #60694 --- .../src/lib/devtools-tabs/devtools-tabs.component.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.ts b/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.ts index 4c9b50fc44f..7794dfe1175 100644 --- a/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.ts +++ b/devtools/projects/ng-devtools/src/lib/devtools-tabs/devtools-tabs.component.ts @@ -95,6 +95,13 @@ export class DevToolsTabsComponent { this.routes.set(routes || []); }); + // Change the tab to Components, if an element is selected via the inspector. + this._messageBus.on('selectComponent', () => { + if (this.activeTab() !== 'Components') { + this.changeTab('Components'); + } + }); + if (typeof chrome !== 'undefined' && chrome.runtime !== undefined) { this.extensionVersion.set(chrome.runtime.getManifest().version); }