From a81e5e34193923d42e2746c94733c64318b7336f Mon Sep 17 00:00:00 2001 From: Igor Kulikov Date: Fri, 5 Jun 2026 15:27:44 +0300 Subject: [PATCH] refactor(iot-hub): streamline deep-link handling on items page Collapse maybeOpenDeepLinkedItem into a single openItemDetail call. Devices resolve via getInstalledItemCounts and pass only the { count } for the deep-linked itemId; every other type resolves via resolveInstalledItem and passes only the matching { installed } entity (no more synthetic 0/1 count for non-device types). --- .../pages/iot-hub/iot-hub-items-page.component.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.ts b/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.ts index 558f929f6a..5f68c586f3 100644 --- a/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.ts +++ b/ui-ngx/src/app/modules/home/pages/iot-hub/iot-hub-items-page.component.ts @@ -135,11 +135,20 @@ export class TbIotHubItemsPageComponent implements OnInit { return; } history.replaceState({ ...history.state, openItem: undefined }, ''); - this.resolveInstalledItem(openItem.version).subscribe(installed => { + + const isDevice = this.config.type === ItemType.DEVICE; + const resolution$: Observable<{ installed?: IotHubInstalledItem; count?: number }> = isDevice + ? this.iotHubApiService + .getInstalledItemCounts(ItemType.DEVICE, { ignoreLoading: true }) + .pipe(map(counts => ({ count: counts[openItem.version.itemId] || 0 }))) + : this.resolveInstalledItem(openItem.version) + .pipe(map(installed => ({ installed: installed ?? undefined }))); + + resolution$.subscribe(({ installed, count }) => { this.iotHubActions.openItemDetail( openItem.version, - installed ?? undefined, - installed ? 1 : 0, + installed, + count, 'default', true, openItem.preview