From 01440845356ca3151a9572829f234ff37efbe5dc Mon Sep 17 00:00:00 2001 From: Mateus Machado Luna Date: Thu, 11 Oct 2018 10:24:31 -0300 Subject: [PATCH] Adds 500ms of debounce before searching for autocomplete and taginput. --- src/classes/filter-types/autocomplete/Autocomplete.vue | 4 ++-- src/classes/filter-types/taginput/Taginput.vue | 4 ++-- src/classes/filter-types/taxonomy/Taginput.vue | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/classes/filter-types/autocomplete/Autocomplete.vue b/src/classes/filter-types/autocomplete/Autocomplete.vue index 0a07ef6d7..4b598b64e 100644 --- a/src/classes/filter-types/autocomplete/Autocomplete.vue +++ b/src/classes/filter-types/autocomplete/Autocomplete.vue @@ -98,7 +98,7 @@ }); this.selectedValues(); }, - search( query ){ + search: _.debounce( function(query) { if (query != '') { let promise = null; this.options = []; @@ -117,7 +117,7 @@ } else { this.cleanSearch(); } - }, + }, 500), selectedValues(){ const instance = this; if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) ) diff --git a/src/classes/filter-types/taginput/Taginput.vue b/src/classes/filter-types/taginput/Taginput.vue index da4e2ba87..73f01de04 100644 --- a/src/classes/filter-types/taginput/Taginput.vue +++ b/src/classes/filter-types/taginput/Taginput.vue @@ -134,7 +134,7 @@ } }, methods: { - search( query ){ + search: _.debounce( function(query) { let promise = null; this.options = []; let valuesToIgnore = []; @@ -155,7 +155,7 @@ .catch( error => { this.$console.log('error select', error ); }); - }, + }, 500), selectedValues(){ const instance = this; if ( !this.query || !this.query.metaquery || !Array.isArray( this.query.metaquery ) ) diff --git a/src/classes/filter-types/taxonomy/Taginput.vue b/src/classes/filter-types/taxonomy/Taginput.vue index 9f51c961c..94dbe6eaa 100644 --- a/src/classes/filter-types/taxonomy/Taginput.vue +++ b/src/classes/filter-types/taxonomy/Taginput.vue @@ -124,7 +124,7 @@ } }, methods: { - search( query ){ + search: _.debounce( function(query) { this.isLoading = true; this.options = []; @@ -161,7 +161,7 @@ this.isLoading = false; this.$console.log(error); }); - }, + }, 500), selectedValues( taxonomy ){ if ( !this.query || !this.query.taxquery || !Array.isArray( this.query.taxquery ) ) return false;