Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions app/code/Magento/Search/view/frontend/web/js/form-mini.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ define([
'</li>',
submitBtn: 'button[type="submit"]',
searchLabel: '[data-role=minisearch-label]',
isExpandable: null
isExpandable: null,
suggestionDelay: 300
},

/** @inheritdoc */
Expand Down Expand Up @@ -104,7 +105,8 @@ define([

this.element.on('focus', this.setActiveState.bind(this, true));
this.element.on('keydown', this._onKeyDown);
this.element.on('input propertychange', this._onPropertyChange);
// Prevent spamming the server with requests by waiting till the user has stopped typing for period of time
this.element.on('input propertychange', _.debounce(this._onPropertyChange, this.options.suggestionDelay));

this.searchForm.on('submit', $.proxy(function (e) {
this._onSubmit(e);
Expand Down