1
0
mirror of https://github.com/metabolist/metatext synced 2024-12-26 17:52:26 +01:00

Fix completion on error

This commit is contained in:
Justin Mazzocchi 2021-01-03 17:28:52 -08:00
parent dc5f9bbbcd
commit 01efe1714f
No known key found for this signature in database
GPG Key ID: E223E6937AAFB01C

View File

@ -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) })
}