File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
app/code/Magento/Search/view/frontend/web Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ define([
43
43
'</li>' ,
44
44
submitBtn : 'button[type="submit"]' ,
45
45
searchLabel : '[data-role=minisearch-label]' ,
46
- isExpandable : null
46
+ isExpandable : null ,
47
+ suggestionDelay : 300
47
48
} ,
48
49
49
50
/** @inheritdoc */
@@ -104,7 +105,8 @@ define([
104
105
105
106
this . element . on ( 'focus' , this . setActiveState . bind ( this , true ) ) ;
106
107
this . element . on ( 'keydown' , this . _onKeyDown ) ;
107
- this . element . on ( 'input propertychange' , this . _onPropertyChange ) ;
108
+ // Prevent spamming the server with requests by waiting till the user has stopped typing for period of time
109
+ this . element . on ( 'input propertychange' , _ . debounce ( this . _onPropertyChange , this . options . suggestionDelay ) ) ;
108
110
109
111
this . searchForm . on ( 'submit' , $ . proxy ( function ( e ) {
110
112
this . _onSubmit ( e ) ;
You can’t perform that action at this time.
0 commit comments