diff options
author | Christopher Ng <chrng8@gmail.com> | 2022-09-15 17:57:10 +0000 |
---|---|---|
committer | Christopher Ng <chrng8@gmail.com> | 2022-09-15 18:55:00 +0000 |
commit | a7c7d84f59e6beecc67d7f8bc8e6d657a32fa121 (patch) | |
tree | 8f51267f7ae848e0e81c8ec282efefaaa4ec7fcf /core/src/views | |
parent | ca747b91d4aa907b191119f080d213bfb5e60fd2 (diff) | |
download | nextcloud-server-a7c7d84f59e6beecc67d7f8bc8e6d657a32fa121.tar.gz nextcloud-server-a7c7d84f59e6beecc67d7f8bc8e6d657a32fa121.zip |
Reset global search on files sidebar navigation change
Signed-off-by: Christopher Ng <chrng8@gmail.com>
Diffstat (limited to 'core/src/views')
-rw-r--r-- | core/src/views/UnifiedSearch.vue | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/core/src/views/UnifiedSearch.vue b/core/src/views/UnifiedSearch.vue index caceeb9006f..5d0a2b62a22 100644 --- a/core/src/views/UnifiedSearch.vue +++ b/core/src/views/UnifiedSearch.vue @@ -150,7 +150,7 @@ </template> <script> -import { emit } from '@nextcloud/event-bus' +import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus' import { minSearchLength, getTypes, search, defaultLimit, regexFilterIn, regexFilterNot, enableLiveSearch } from '../services/UnifiedSearchService' import { showError } from '@nextcloud/dialogs' @@ -329,10 +329,15 @@ export default { }, async created() { + subscribe('files:navigation:changed', this.resetForm) this.types = await getTypes() this.logger.debug('Unified Search initialized with the following providers', this.types) }, + beforeDestroy() { + unsubscribe('files:navigation:changed', this.resetForm) + }, + mounted() { if (OCP.Accessibility.disableKeyboardShortcuts()) { return @@ -371,6 +376,10 @@ export default { emit('nextcloud:unified-search.close') }, + resetForm() { + this.$el.querySelector('form[role="search"]').reset() + }, + /** * Reset the search state */ |