mirror of
https://github.com/metabolist/metatext.git
synced 2024-11-28 19:11:30 +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 {
|
private extension CollectionItemsViewModel {
|
||||||
func cache(viewModel: CollectionItemViewModel, forItem item: CollectionItem) {
|
func cache(viewModel: CollectionItemViewModel, forItem item: CollectionItem) {
|
||||||
viewModelCache[item] = (viewModel, viewModel.events.flatMap { $0 }
|
viewModelCache[item] = (viewModel, viewModel.events
|
||||||
.assignErrorsToAlertItem(to: \.alertItem, on: self)
|
.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) })
|
.sink { [weak self] in self?.eventsSubject.send($0) })
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue