Skip to content

Commit 094c919

Browse files
committed
Use a default duration for smart debounce
1 parent 6d45ae6 commit 094c919

File tree

7 files changed

+8
-8
lines changed

7 files changed

+8
-8
lines changed

Modules/Sources/PointOfSale/Presentation/Orders/POSOrderListView.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ final class POSOrderSearchable: POSSearchable {
369369
// Use smart debouncing for order search to match original behavior:
370370
// don't debounce first keystroke to show loading immediately,
371371
// then debounce subsequent keystrokes while search is ongoing
372-
.smart(duration: 500 * NSEC_PER_MSEC)
372+
.smart()
373373
}
374374

375375
var searchDebounceStrategy: SearchDebounceStrategy {

Modules/Sources/PointOfSale/Utils/PreviewHelpers.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ final class PointOfSalePreviewCouponsController: PointOfSaleCouponsControllerPro
107107
itemsStack: ItemsStackState(root: .loading([]),
108108
itemStates: [:]))
109109
var currentDebounceStrategy: SearchDebounceStrategy { .immediate }
110-
var searchDebounceStrategy: SearchDebounceStrategy { .smart(duration: 500 * NSEC_PER_MSEC) }
110+
var searchDebounceStrategy: SearchDebounceStrategy { .smart() }
111111
func enableCoupons() async { }
112112
func loadItems(base: ItemListBaseItem) async { }
113113
func refreshItems(base: ItemListBaseItem) async { }
@@ -122,7 +122,7 @@ final class PointOfSalePreviewItemsController: PointOfSaleSearchingItemsControll
122122
itemStates: [:]))
123123

124124
var currentDebounceStrategy: SearchDebounceStrategy { .immediate }
125-
var searchDebounceStrategy: SearchDebounceStrategy { .smart(duration: 500 * NSEC_PER_MSEC) }
125+
var searchDebounceStrategy: SearchDebounceStrategy { .smart() }
126126

127127
func loadItems(base: ItemListBaseItem) async {
128128
switch base {

Modules/Sources/Yosemite/PointOfSale/Coupons/PointOfSaleCouponFetchStrategy.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ struct PointOfSaleSearchCouponFetchStrategy: PointOfSaleCouponFetchStrategy {
102102
var debounceStrategy: SearchDebounceStrategy {
103103
// Use smart debouncing for remote coupon search
104104
// No loading delay threshold - show loading immediately for responsive feel
105-
.smart(duration: 500 * NSEC_PER_MSEC)
105+
.smart()
106106
}
107107

108108
func fetchCoupons(pageNumber: Int) async throws -> PagedItems<POSItem> {

Modules/Sources/Yosemite/PointOfSale/Items/PointOfSalePurchasableItemFetchStrategy.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ public struct PointOfSaleSearchPurchasableItemFetchStrategy: PointOfSalePurchasa
8585
// Use smart debouncing for remote search: don't debounce first keystroke to show loading immediately,
8686
// then debounce subsequent keystrokes while search is ongoing.
8787
// No loading delay threshold - show loading immediately for responsive feel.
88-
.smart(duration: 500 * NSEC_PER_MSEC)
88+
.smart()
8989
}
9090

9191
public func fetchProducts(pageNumber: Int) async throws -> PagedItems<POSProduct> {

Modules/Sources/Yosemite/PointOfSale/Items/SearchDebounceStrategy.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ public enum SearchDebounceStrategy: Equatable {
88
/// - Parameters:
99
/// - duration: The debounce duration in nanoseconds for subsequent keystrokes
1010
/// - loadingDelayThreshold: Optional threshold in nanoseconds before showing loading indicators. If nil, shows loading immediately.
11-
case smart(duration: UInt64, loadingDelayThreshold: UInt64? = nil)
11+
case smart(duration: UInt64 = 500 * NSEC_PER_MSEC, loadingDelayThreshold: UInt64? = nil)
1212

1313
/// Simple debouncing: Always debounce every keystroke by the specified duration.
1414
/// Optionally delays showing loading indicators until a threshold is exceeded.

Modules/Tests/PointOfSaleTests/Mocks/MockPointOfSaleCouponsController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ final class MockPointOfSaleCouponsController: PointOfSaleCouponsControllerProtoc
1010
itemsStack: .init(root: .empty, itemStates: [:]))
1111

1212
var currentDebounceStrategy: SearchDebounceStrategy = .immediate
13-
var searchDebounceStrategy: SearchDebounceStrategy = .smart(duration: 500 * NSEC_PER_MSEC)
13+
var searchDebounceStrategy: SearchDebounceStrategy = .smart()
1414

1515
func loadItems(base: ItemListBaseItem) async {
1616
loadItemsCalled = true

Modules/Tests/PointOfSaleTests/Mocks/MockPointOfSalePurchasableItemsSearchController.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ final class MockPointOfSalePurchasableItemsSearchController: PointOfSaleSearchin
99
itemsStack: .init(root: .empty, itemStates: [:]))
1010

1111
var currentDebounceStrategy: SearchDebounceStrategy = .immediate
12-
var searchDebounceStrategy: SearchDebounceStrategy = .smart(duration: 500 * NSEC_PER_MSEC)
12+
var searchDebounceStrategy: SearchDebounceStrategy = .smart()
1313

1414
func searchItems(searchTerm: String, baseItem: ItemListBaseItem) async {}
1515

0 commit comments

Comments
 (0)