[wp-trac] [WordPress Trac] #42348: Themes search: reintroduce the debounced search

WordPress Trac noreply at wordpress.org
Thu Oct 26 20:58:27 UTC 2017


#42348: Themes search: reintroduce the debounced search
--------------------------+--------------------------------------------
 Reporter:  afercia       |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  4.9
Component:  Customize     |     Version:  trunk
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |     Focuses:  ui, accessibility, javascript
--------------------------+--------------------------------------------

Comment (by afercia):

 > My intention was that it should do a search with the first keystroke and
 then will do a subsequent search when the user stops typing.
 > But it isn't working as I expected.

 It works exactly as expected. Unfortunately, its usage in this
 implementation is wrong. In the theme installer for example, the throttled
 function `doSearch()` is called at each keystroke and executes
 immediately. `doSearch()` in turns calls each time `this.collection.query(
 request );` so the search is actually triggered at each keystroke. Very
 simple.

 `debounce()` instead works differently and it will continuously postpone
 the execution while the function is called. When the function is not
 called any longer (the user has finished typing), the debounced function
 will run after the specified delay.

 > With 42348.diff​ the “flash of unsearched content” returns.
 I see it happens just when there's a search term entered in the search
 field? I'd say that's a minor edge case compared to the breakage this
 change is causing. Not to mention hammering the servers with multiple AJAX
 calls.

 I'd just like to point out this change is actually breaking a working
 functionality that was agreed on and broadly discussed. So it's actually a
 regression in trunk.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/42348#comment:6>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list