Commit 5202ca4
committed
Add loadingDelayThreshold to smart debounce strategy
Adds optional loading delay threshold parameter to smart debounce strategy.
This enables delayed loading indicators for fast local searches to prevent
flicker, while maintaining immediate loading indicators for remote searches.
Changes:
- Add optional loadingDelayThreshold parameter to SearchDebounceStrategy.smart case
- Update POSSearchView to handle smart strategy with optional threshold:
- Check for non-empty search term before showing loading (prevents loading on initial view)
- Reset didFinishSearch to true when search view appears (ensures first search shows loading)
- First keystroke without threshold: Show loading immediately (remote searches)
- First keystroke with threshold: Delay loading until threshold or completion (local searches)
- Subsequent keystrokes: Debounce request, loading already showing
- Remote searches use .smart without threshold for immediate responsive feedback
- Local searches use .simple with threshold to prevent flicker on fast queries
- Update test expectations to match strategy configurations
Fixes:
- No loading indicators shown when opening search view with popular products
- Loading indicators show immediately on first search keystroke for remote searches
- Local searches avoid flicker by only showing loading if query takes longer than threshold1 parent 3aa198b commit 5202ca4
File tree
6 files changed
+69
-13
lines changed- Modules/Sources
- PointOfSale/Presentation/Item Search
- Yosemite/PointOfSale
- Coupons
- Items
- WooCommerce
- WooCommerce.xcodeproj
- WooCommerceTests/Tools
6 files changed
+69
-13
lines changedLines changed: 55 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
72 | 97 | | |
73 | | - | |
| 98 | + | |
| 99 | + | |
74 | 100 | | |
75 | 101 | | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
76 | 123 | | |
77 | 124 | | |
78 | 125 | | |
| |||
139 | 186 | | |
140 | 187 | | |
141 | 188 | | |
| 189 | + | |
142 | 190 | | |
143 | 191 | | |
144 | 192 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
101 | 101 | | |
102 | 102 | | |
103 | 103 | | |
| 104 | + | |
104 | 105 | | |
105 | 106 | | |
106 | 107 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
85 | | - | |
| 85 | + | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
6 | 7 | | |
7 | | - | |
8 | | - | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
9 | 12 | | |
10 | 13 | | |
11 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16586 | 16586 | | |
16587 | 16587 | | |
16588 | 16588 | | |
| 16589 | + | |
16589 | 16590 | | |
16590 | 16591 | | |
16591 | 16592 | | |
| |||
16594 | 16595 | | |
16595 | 16596 | | |
16596 | 16597 | | |
16597 | | - | |
| 16598 | + | |
16598 | 16599 | | |
16599 | 16600 | | |
16600 | 16601 | | |
| |||
17392 | 17393 | | |
17393 | 17394 | | |
17394 | 17395 | | |
| 17396 | + | |
17395 | 17397 | | |
17396 | 17398 | | |
17397 | 17399 | | |
| |||
17400 | 17402 | | |
17401 | 17403 | | |
17402 | 17404 | | |
17403 | | - | |
| 17405 | + | |
17404 | 17406 | | |
17405 | 17407 | | |
17406 | 17408 | | |
| |||
17422 | 17424 | | |
17423 | 17425 | | |
17424 | 17426 | | |
| 17427 | + | |
17425 | 17428 | | |
17426 | 17429 | | |
17427 | 17430 | | |
| |||
17430 | 17433 | | |
17431 | 17434 | | |
17432 | 17435 | | |
17433 | | - | |
| 17436 | + | |
17434 | 17437 | | |
17435 | 17438 | | |
17436 | 17439 | | |
| |||
Binary file not shown.
0 commit comments