From a247dfc095b52864e18e192deb97ed81ad7570e1 Mon Sep 17 00:00:00 2001 From: sambhu Date: Tue, 22 Sep 2026 19:59:44 +0530 Subject: [PATCH 1/2] fix(list-view): sync selected row when bound property changes elsewhere --- .../template/list-view/list-view.component.ts | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/packages/angular-sdk-components/src/lib/_components/template/list-view/list-view.component.ts b/packages/angular-sdk-components/src/lib/_components/template/list-view/list-view.component.ts index 239e6430..43d8f940 100644 --- a/packages/angular-sdk-components/src/lib/_components/template/list-view/list-view.component.ts +++ b/packages/angular-sdk-components/src/lib/_components/template/list-view/list-view.component.ts @@ -18,6 +18,7 @@ import { DragDropModule, CdkDragDrop, moveItemInArray, CdkDropList, CdkDrag } fr import { ProgressSpinnerService } from '../../../_messages/progress-spinner.service'; import { Utils } from '../../../_helpers/utils'; import { ComponentMapperComponent } from '../../../_bridge/component-mapper/component-mapper.component'; +import { AngularPConnectData, AngularPConnectService } from '../../../_bridge/angular-pconnect'; import { getCurrencyOptions } from '../../../_helpers/currency-utils'; import { getLocale, getSeconds } from '../../../_helpers/common'; import { formatters } from '../../../_helpers/formatters/format-utils'; @@ -162,18 +163,28 @@ export class ListViewComponent implements OnInit, OnDestroy { paging: any; fieldDefs: any; checkBoxValue: string; + // Last value seen on the bound property, used to detect external changes. + lastSelectedPropValue: any; label?: string = ''; uniqueId = crypto.randomUUID(); displayAs: any; showRecords: any; identifier: string; promotedFiltersId: string; + + // Used with AngularPConnect + angularPConnectData: AngularPConnectData = {}; + constructor( + private angularPConnect: AngularPConnectService, private psService: ProgressSpinnerService, public utils: Utils ) {} ngOnInit(): void { + // First thing in initialization is registering and subscribing to the AngularPConnect service + this.angularPConnectData = this.angularPConnect.registerAndSubscribeComponent(this, this.onStateChange); + this.configProps$ = this.pConn$.getConfigProps() as ListViewProps; /** By default, pyGUID is used for Data classes and pyID is for Work classes as row-id/key */ const defRowID = this.configProps$?.referenceType === 'Case' ? 'pyID' : 'pyGUID'; @@ -197,6 +208,7 @@ export class ListViewComponent implements OnInit, OnDestroy { this.selectionMode = this.configProps$.selectionMode; this.checkBoxValue = this.configProps$.value; + this.lastSelectedPropValue = this.configProps$.value; this.arFilterMainButtons$.push({ actionID: 'submit', jsAction: 'submit', name: 'Submit' }); this.arFilterSecondaryButtons$.push({ actionID: 'cancel', jsAction: 'cancel', name: 'Cancel' }); @@ -266,6 +278,29 @@ export class ListViewComponent implements OnInit, OnDestroy { this.clearSelectionsAndUpdateTable(this.pConn$, this.uniqueId, this.configProps$?.viewName); } + onStateChange() { + // Should always check the bridge to see if the component should + // update itself (re-render) + const bUpdateSelf = this.angularPConnect.shouldComponentUpdate(this); + + // ONLY call updateSelf when the component should update + if (bUpdateSelf) { + this.updateSelf(); + } + } + + updateSelf(): void { + // The selected row is driven by the bound property, which another field on the screen may change. + const latestConfigProps = this.pConn$.getConfigProps() as ListViewProps; + const latestValue = latestConfigProps?.value; + + // Only re-sync on an actual property change, so a row the user just picked is not reverted. + if (this.selectionMode === SELECTION_MODE.SINGLE && latestValue !== this.lastSelectedPropValue) { + this.lastSelectedPropValue = latestValue; + this.checkBoxValue = latestValue; + } + } + clearSelectionsAndUpdateTable(getPConnect: any, uniqueId: string, viewName): void { const clearSelectionsAndRefreshList = ({ viewName: name, clearSelections }: any) => { if (name === viewName) { @@ -487,6 +522,10 @@ export class ListViewComponent implements OnInit, OnDestroy { // } ngOnDestroy() { + if (this.angularPConnectData.unsubscribeFn) { + this.angularPConnectData.unsubscribeFn(); + } + PCore.getPubSubUtils().unsubscribe( PCore.getConstants().PUB_SUB_EVENTS.EVENT_DASHBOARD_FILTER_CHANGE, `dashboard-component-${'id'}`, From 490691c6cfe085b69dce5eaafb728f533fa6f48e Mon Sep 17 00:00:00 2001 From: sambhu Date: Tue, 22 Sep 2026 20:21:23 +0530 Subject: [PATCH 2/2] chore(changelog): add entry for list view selection sync fix --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 78f8e117..152d045b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -37,6 +37,8 @@ * Github: [PR-574](https://github.com/pegasystems/angular-sdk-components/pull/574) * **Fixed collapsible and expandable behavior in FieldGroup.** * Github: [PR-579](https://github.com/pegasystems/angular-sdk-components/pull/579) +* **Fixed the issue where changing a property value on the screen was not reflected in the list below.** + * Github: [PR-581](https://github.com/pegasystems/angular-sdk-components/pull/581) # [25.1.13](https://github.com/pegasystems/angular-sdk/tree/release/25.1.13) - Released: 12/06/2026