Skip to content

Commit 2dc3ff6

Browse files
committed
Rename debounceStrategy to currentDebounceStrategy for clarity
The POSSearchable protocol had two confusingly named properties: - debounceStrategy: The currently active strategy - searchDebounceStrategy: The strategy that will be used for searches Renamed debounceStrategy → currentDebounceStrategy to make the distinction clear: currentDebounceStrategy reflects what's active right now, while searchDebounceStrategy reflects what will be used when searching. This improves code readability without changing any behavior.
1 parent 5e4e396 commit 2dc3ff6

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

Modules/Sources/PointOfSale/Presentation/Item Search/POSProductSearchable.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ final class POSProductSearchable: POSSearchable {
2525
itemListType.itemType.searchFieldLabel
2626
}
2727

28-
var debounceStrategy: SearchDebounceStrategy {
28+
var currentDebounceStrategy: SearchDebounceStrategy {
2929
itemsController.currentDebounceStrategy
3030
}
3131

Modules/Sources/PointOfSale/Presentation/Item Search/POSSearchView.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ protocol POSSearchable {
88
var searchFieldPlaceholder: String { get }
99
/// Recent search history for the current item type
1010
var searchHistory: [String] { get }
11-
/// The debouncing strategy to use for search input
12-
var debounceStrategy: SearchDebounceStrategy { get }
11+
/// The debouncing strategy currently active based on the controller's current state
12+
var currentDebounceStrategy: SearchDebounceStrategy { get }
1313
/// The debouncing strategy that will be used when performing a search (may differ from current strategy)
1414
var searchDebounceStrategy: SearchDebounceStrategy { get }
1515

@@ -64,8 +64,8 @@ struct POSSearchField: View {
6464

6565
// Capture the debounce strategy synchronously BEFORE creating the task.
6666
// Use searchDebounceStrategy for non-empty search terms (actual searches),
67-
// and debounceStrategy for empty terms (returning to popular products).
68-
let debounceStrategy = newValue.isNotEmpty ? searchable.searchDebounceStrategy : searchable.debounceStrategy
67+
// and currentDebounceStrategy for empty terms (returning to popular products).
68+
let debounceStrategy = newValue.isNotEmpty ? searchable.searchDebounceStrategy : searchable.currentDebounceStrategy
6969

7070
searchTask = Task {
7171
// Apply debouncing based on the strategy captured at the start

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ final class POSOrderSearchable: POSSearchable {
365365
[]
366366
}
367367

368-
var debounceStrategy: SearchDebounceStrategy {
368+
var currentDebounceStrategy: SearchDebounceStrategy {
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
@@ -374,7 +374,7 @@ final class POSOrderSearchable: POSSearchable {
374374

375375
var searchDebounceStrategy: SearchDebounceStrategy {
376376
// Orders use the same strategy for both modes
377-
debounceStrategy
377+
currentDebounceStrategy
378378
}
379379

380380
func performSearch(term: String) async {

0 commit comments

Comments
 (0)