aboutsummaryrefslogtreecommitdiffstats
path: root/core/js
diff options
context:
space:
mode:
authorChristoph Wurst <christoph@winzerhof-wurst.at>2017-10-09 15:09:11 +0200
committerChristoph Wurst <christoph@winzerhof-wurst.at>2017-10-12 16:26:01 +0200
commit0c7d745074a2bfaa02391bb8935a45569a64e8de (patch)
tree0c9d8edfd0d2b790e7971b72b155ce8fabd23110 /core/js
parentfbeb6659f82cc501cc1361795532f7f18e6e764a (diff)
downloadnextcloud-server-0c7d745074a2bfaa02391bb8935a45569a64e8de.tar.gz
nextcloud-server-0c7d745074a2bfaa02391bb8935a45569a64e8de.zip
Fix contacts menu for IE11
IE11 triggers an 'input' event whenever an input is focussed or loses focus. Thus this causes an endless loading loop as soon as the view is re-rendered. To prevent this, this remembers the previous search term and ignores events where the term has not changed. Fixes https://github.com/nextcloud/server/issues/5281 Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'core/js')
-rw-r--r--core/js/contactsmenu.js15
1 files changed, 13 insertions, 2 deletions
diff --git a/core/js/contactsmenu.js b/core/js/contactsmenu.js
index 3da6ea127cd..59f61a093eb 100644
--- a/core/js/contactsmenu.js
+++ b/core/js/contactsmenu.js
@@ -286,6 +286,9 @@
/** @type {undefined|ContactCollection} */
_contacts: undefined,
+ /** @type {string} */
+ _searchTerm: '',
+
events: {
'input #contactsmenu-search': '_onSearch'
},
@@ -293,8 +296,16 @@
/**
* @returns {undefined}
*/
- _onSearch: _.debounce(function() {
- this.trigger('search', this.$('#contactsmenu-search').val());
+ _onSearch: _.debounce(function(e) {
+ var searchTerm = this.$('#contactsmenu-search').val();
+ // IE11 triggers an 'input' event after the view has been rendered
+ // resulting in an endless loading loop. To prevent this, we remember
+ // the last search term to savely ignore some events
+ // See https://github.com/nextcloud/server/issues/5281
+ if (searchTerm !== this._searchTerm) {
+ this.trigger('search', this.$('#contactsmenu-search').val());
+ this._searchTerm = searchTerm;
+ }
}, 700),
/**