diff --git a/GRDB/ValueObservation/ValueObservation+Count.swift b/GRDB/ValueObservation/ValueObservation+Count.swift index 78ff705bc..a702fc933 100644 --- a/GRDB/ValueObservation/ValueObservation+Count.swift +++ b/GRDB/ValueObservation/ValueObservation+Count.swift @@ -28,6 +28,7 @@ extension ValueObservation where Reducer == Void { public static func trackingCount(_ request: Request) -> ValueObservation>> { + // TODO: Remove distinctUntilChanged in GRDB 4 return ValueObservation.tracking(request, fetch: request.fetchCount).distinctUntilChanged() } } diff --git a/GRDB/ValueObservation/ValueObservation+DatabaseValueConvertible.swift b/GRDB/ValueObservation/ValueObservation+DatabaseValueConvertible.swift index c32634532..63577d900 100644 --- a/GRDB/ValueObservation/ValueObservation+DatabaseValueConvertible.swift +++ b/GRDB/ValueObservation/ValueObservation+DatabaseValueConvertible.swift @@ -124,6 +124,7 @@ public struct DatabaseValuesReducer: ValueReducer public mutating func value(_ dbValues: [DatabaseValue]) -> [Request.RowDecoder]? { if let previousDbValues = previousDbValues, previousDbValues == dbValues { // Don't notify consecutive identical dbValue arrays + // TODO: Remove this implicit `distinctUntilChanged` in GRDB 4 return nil } self.previousDbValues = dbValues @@ -157,6 +158,7 @@ public struct DatabaseValueReducer: ValueReducer public mutating func value(_ dbValue: DatabaseValue?) -> Request.RowDecoder?? { if let previousDbValue = previousDbValue, previousDbValue == dbValue { // Don't notify consecutive identical dbValue + // TODO: Remove this implicit `distinctUntilChanged` in GRDB 4 return nil } self.previousDbValue = dbValue @@ -167,6 +169,7 @@ public struct DatabaseValueReducer: ValueReducer return .some(value) } else if previousValueWasNil { // Don't notify consecutive nil values + // TODO: Remove this implicit `distinctUntilChanged` in GRDB 4 return nil } else { previousValueWasNil = true @@ -200,6 +203,7 @@ public struct OptionalDatabaseValuesReducer: ValueReducer public mutating func value(_ dbValues: [DatabaseValue]) -> [Request.RowDecoder._Wrapped?]? { if let previousDbValues = previousDbValues, previousDbValues == dbValues { // Don't notify consecutive identical dbValue arrays + // TODO: Remove this implicit `distinctUntilChanged` in GRDB 4 return nil } self.previousDbValues = dbValues diff --git a/GRDB/ValueObservation/ValueObservation+FetchableRecord.swift b/GRDB/ValueObservation/ValueObservation+FetchableRecord.swift index 1f18722fd..a9eb2431a 100644 --- a/GRDB/ValueObservation/ValueObservation+FetchableRecord.swift +++ b/GRDB/ValueObservation/ValueObservation+FetchableRecord.swift @@ -91,6 +91,7 @@ public struct FetchableRecordsReducer: ValueReducer public mutating func value(_ rows: [Row]) -> [Request.RowDecoder]? { if let previousRows = previousRows, previousRows == rows { // Don't notify consecutive identical row arrays + // TODO: Remove this implicit `distinctUntilChanged` in GRDB 4 return nil } self.previousRows = rows @@ -121,6 +122,7 @@ public struct FetchableRecordReducer: ValueReducer public mutating func value(_ row: Row?) -> Request.RowDecoder?? { if let previousRow = previousRow, previousRow == row { // Don't notify consecutive identical rows + // TODO: Remove this implicit `distinctUntilChanged` in GRDB 4 return nil } self.previousRow = row diff --git a/GRDB/ValueObservation/ValueObservation+Row.swift b/GRDB/ValueObservation/ValueObservation+Row.swift index e041f2e06..011fa3aa5 100644 --- a/GRDB/ValueObservation/ValueObservation+Row.swift +++ b/GRDB/ValueObservation/ValueObservation+Row.swift @@ -120,6 +120,7 @@ public struct RowReducer: ValueReducer public mutating func value(_ row: Row?) -> Row?? { if let previousRow = previousRow, previousRow == row { // Don't notify consecutive identical rows + // TODO: Remove this implicit `distinctUntilChanged` in GRDB 4 return nil } self.previousRow = row