diff --git a/commons/src/main/java/org/dhis2/commons/filters/workingLists/WorkingListChipGroup.kt b/commons/src/main/java/org/dhis2/commons/filters/workingLists/WorkingListChipGroup.kt index 176adc638f..ae17255d2b 100644 --- a/commons/src/main/java/org/dhis2/commons/filters/workingLists/WorkingListChipGroup.kt +++ b/commons/src/main/java/org/dhis2/commons/filters/workingLists/WorkingListChipGroup.kt @@ -84,6 +84,13 @@ fun WorkingListChipGroup( FilterManager.getInstance().currentWorkingList(), ) } + FilterManager.getInstance().observeWorkingListScope().addOnPropertyChangedCallback( + object : Observable.OnPropertyChangedCallback() { + override fun onPropertyChanged(sender: Observable?, propertyId: Int) { + selectedWorkingList = FilterManager.getInstance().currentWorkingList() + } + }, + ) workingListFilterState.value?.let { workingListFilter -> LazyRow(modifier) { @@ -98,10 +105,9 @@ fun WorkingListChipGroup( }, ), label = workingList.label, - selected = selectedWorkingList == workingList, + selected = selectedWorkingList?.uid == workingList.uid, onSelected = { _ -> workingListFilter.onChecked(workingList.id()) - selectedWorkingList = FilterManager.getInstance().currentWorkingList() }, ) }