mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-22 00:01:00 +00:00
Fix completion on error
This commit is contained in:
parent
dc5f9bbbcd
commit
01efe1714f
1 changed files with 7 additions and 2 deletions
|
@ -284,8 +284,13 @@ extension CollectionItemsViewModel: CollectionViewModel {
|
|||
|
||||
private extension CollectionItemsViewModel {
|
||||
func cache(viewModel: CollectionItemViewModel, forItem item: CollectionItem) {
|
||||
viewModelCache[item] = (viewModel, viewModel.events.flatMap { $0 }
|
||||
.assignErrorsToAlertItem(to: \.alertItem, on: self)
|
||||
viewModelCache[item] = (viewModel, viewModel.events
|
||||
.flatMap { [weak self] events -> AnyPublisher<CollectionItemEvent, Never> in
|
||||
guard let self = self else { return Empty().eraseToAnyPublisher() }
|
||||
|
||||
return events.assignErrorsToAlertItem(to: \.alertItem, on: self)
|
||||
.eraseToAnyPublisher()
|
||||
}
|
||||
.sink { [weak self] in self?.eventsSubject.send($0) })
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue