Skip to content

Commit

Permalink
Double back on Equatable
Browse files Browse the repository at this point in the history
  • Loading branch information
Iron-Ham committed Jul 23, 2024
1 parent 475cd10 commit f5e5d91
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Combine
import Foundation

/// Type-erases a query pager, transforming data from a generic type to a specific type, often a view model or array of view models.
public class AsyncGraphQLQueryPager<Model: Equatable>: Publisher {
public class AsyncGraphQLQueryPager<Model>: Publisher {
public typealias Failure = Never
public typealias Output = Result<Model, any Error>
let _subject: CurrentValueSubject<Output?, Never> = .init(nil)
Expand Down Expand Up @@ -117,11 +117,6 @@ public class AsyncGraphQLQueryPager<Model: Equatable>: Publisher {
public func receive<S>(
subscriber: S
) where S: Subscriber, Never == S.Failure, Result<Model, any Error> == S.Input {
publisher
.removeDuplicates(by: { _lhs, _rhs in
guard let lhs = try? _lhs.get(), let rhs = try? _rhs.get() else { return false }
return lhs == rhs
})
.subscribe(subscriber)
publisher.subscribe(subscriber)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Combine
import Foundation

/// Type-erases a query pager, transforming data from a generic type to a specific type, often a view model or array of view models.
public class GraphQLQueryPager<Model: Equatable>: Publisher {
public class GraphQLQueryPager<Model>: Publisher {
public typealias Failure = Never
public typealias Output = Result<Model, any Error>
let _subject: CurrentValueSubject<Output?, Never> = .init(nil)
Expand Down Expand Up @@ -130,11 +130,6 @@ public class GraphQLQueryPager<Model: Equatable>: Publisher {
public func receive<S>(
subscriber: S
) where S: Subscriber, Never == S.Failure, Result<Model, any Error> == S.Input {
publisher
.removeDuplicates(by: { _lhs, _rhs in
guard let lhs = try? _lhs.get(), let rhs = try? _rhs.get() else { return false }
return lhs == rhs
})
.subscribe(subscriber)
publisher.subscribe(subscriber)
}
}

0 comments on commit f5e5d91

Please sign in to comment.