diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-13 21:08:33 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-04-13 21:08:33 +0300 |
commit | 953eb09e086c8f2842512a62e56e32223b5bf974 (patch) | |
tree | 3915a57e930263b7c31a1b5e819db50f7d3a609f /app/assets/javascripts/vue_shared/components/filtered_search_bar | |
parent | 907fd5d94ecec19ff7de4986e83e75e6fa082558 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/vue_shared/components/filtered_search_bar')
-rw-r--r-- | app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue | 32 |
1 files changed, 5 insertions, 27 deletions
diff --git a/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue b/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue index 5cdf7b6a3b2..6a9f62a91c4 100644 --- a/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue +++ b/app/assets/javascripts/vue_shared/components/filtered_search_bar/filtered_search_bar_root.vue @@ -163,33 +163,6 @@ export default { return undefined; }, }, - watch: { - /** - * GlFilteredSearch currently doesn't emit any event when - * tokens are manually removed from search field so we'd - * never know when user actually clears all the tokens. - * This watcher listens for updates to `filterValue` on - * such instances. :( - */ - filterValue(newValue, oldValue) { - const [firstVal] = newValue; - if ( - !this.initialRender && - newValue.length === 1 && - firstVal.type === 'filtered-search-term' && - !firstVal.value.data - ) { - const filtersCleared = - oldValue[0].type !== 'filtered-search-term' || oldValue[0].value.data !== ''; - this.$emit('onFilter', [], filtersCleared); - } - - // Set initial render flag to false - // as we don't want to emit event - // on initial load when value is empty already. - this.initialRender = false; - }, - }, created() { if (this.recentSearchesStorageKey) this.setupRecentSearch(); }, @@ -322,6 +295,10 @@ export default { return tokenOption.title; }, + onClear() { + const cleared = true; + this.$emit('onFilter', [], cleared); + }, }, }; </script> @@ -345,6 +322,7 @@ export default { :suggestions-list-class="suggestionsListClass" class="flex-grow-1" @history-item-selected="handleHistoryItemSelected" + @clear="onClear" @clear-history="handleClearHistory" @submit="handleFilterSubmit" > |