Skip to content

Commit 7c68b57

Browse files
fix: redundant search request sent by NumberRangeConnector (#283)
1 parent b0a66f4 commit 7c68b57

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

Sources/InstantSearchCore/NumberRange/NumberRangeInteractor.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,11 @@ public class NumberRangeInteractor<Number: Comparable & DoubleRepresentable>: It
4242

4343
/// Set the bounds value and clamps the current range value to it
4444
public func applyBounds(bounds: ClosedRange<Number>?) {
45-
let limitedRange = limitRange(item, limitedBy: bounds)
4645
self.bounds = bounds
4746
onBoundsComputed.fire(bounds)
48-
onNumberRangeComputed.fire(limitedRange)
47+
if let limitedRange = limitRange(item, limitedBy: bounds), limitedRange != item {
48+
onNumberRangeComputed.fire(limitedRange)
49+
}
4950
}
5051

5152
public func computeNumberRange(numberRange: ClosedRange<Number>?) {

0 commit comments

Comments
 (0)