fix: Clear search input which navigating to other tab/page (#2061)

This commit is contained in:
Niklas Haug
2021-04-22 10:28:04 +02:00
committed by GitHub
parent 6c7c5064d1
commit 87078e1abf
4 changed files with 33 additions and 6 deletions

View File

@@ -82,6 +82,7 @@ export default {
...mapGetters({
conversations: 'conversationSearch/getConversations',
uiFlags: 'conversationSearch/getUIFlags',
currentPage: 'conversationPage/getCurrentPage',
}),
resultsCount() {
return this.conversations.length;
@@ -111,10 +112,16 @@ export default {
this.$store.dispatch('conversationSearch/get', { q: newValue });
}, 1000);
},
currentPage() {
this.clearSearchTerm();
},
},
mounted() {
this.$store.dispatch('conversationSearch/get', { q: '' });
bus.$on('clearSearchInput', () => {
this.clearSearchTerm();
});
},
methods: {
@@ -124,6 +131,9 @@ export default {
closeSearch() {
this.showSearchBox = false;
},
clearSearchTerm() {
this.searchTerm = '';
},
},
};
</script>