Skip to content

Commit c19bff0

Browse files
Pytalbackportbot-nextcloud[bot]
authored andcommitted
Reset global search on files sidebar navigation change
Signed-off-by: Christopher Ng <chrng8@gmail.com>
1 parent f263930 commit c19bff0

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

apps/files/js/app.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@
309309
this._changeUrl(params.view, params.dir);
310310
OC.Apps.hideAppSidebar($('.detailsView'));
311311
this.navigation.getActiveContainer().trigger(new $.Event('urlChanged', params));
312+
window._nc_event_bus.emit('files:navigation:changed')
312313
}
313314
},
314315

@@ -360,6 +361,7 @@
360361
this.navigation.getActiveContainer().trigger(new $.Event('show'));
361362
}
362363
this.navigation.getActiveContainer().trigger(new $.Event('urlChanged', params));
364+
window._nc_event_bus.emit('files:navigation:changed')
363365
},
364366

365367
/**

core/src/views/UnifiedSearch.vue

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -300,10 +300,15 @@ export default {
300300
},
301301
302302
async created() {
303+
subscribe('files:navigation:changed', this.resetForm)
303304
this.types = await getTypes()
304305
this.logger.debug('Unified Search initialized with the following providers', this.types)
305306
},
306307
308+
beforeDestroy() {
309+
unsubscribe('files:navigation:changed', this.resetForm)
310+
},
311+
307312
mounted() {
308313
document.addEventListener('keydown', (event) => {
309314
// if not already opened, allows us to trigger default browser on second keydown
@@ -338,6 +343,10 @@ export default {
338343
emit('nextcloud:unified-search.close')
339344
},
340345
346+
resetForm() {
347+
this.$el.querySelector('form[role="search"]').reset()
348+
},
349+
341350
/**
342351
* Reset the search state
343352
*/

0 commit comments

Comments
 (0)