Skip to content

Commit 6f93ca4

Browse files
committed
Cancel observation token of the same type before setting to another value.
1 parent 845d231 commit 6f93ca4

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

WooCommerce/Classes/ViewRelated/Filters/FilterListViewController.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,15 @@ private extension FilterListViewController {
183183
}
184184

185185
func observeListSelectorCommandItemSelection() {
186+
cancellableSelectedFilterType?.cancel()
186187
cancellableSelectedFilterType = listSelectorCommand.onItemSelected.subscribe { [weak self] selected in
187188
guard let self = self else {
188189
return
189190
}
190191

191192
switch selected.listSelectorConfig {
192193
case .staticOptions(let options):
194+
self.cancellableSelectedFilterValue?.cancel()
193195
let command = StaticListSelectorCommand(navigationBarTitle: selected.title,
194196
data: options,
195197
selected: selected.selectedValue)

0 commit comments

Comments
 (0)