Skip to content

Commit

Permalink
fix(files): Debounce does not return a function so it should be used …
Browse files Browse the repository at this point in the history
…as computed

This also fixes hacky solution to `this` access

Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
  • Loading branch information
susnux committed May 17, 2024
1 parent 8269f55 commit 409b2ba
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions apps/files/src/views/FilesList.vue
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,16 @@ export default defineComponent({
},

computed: {
/**
* Handle search event from unified search.
*/
onSearch() {
return debounce((searchEvent: { query: string }) => {
console.debug('Files app handling search event from unified search...', searchEvent)
this.filterText = searchEvent.query
}, 500)
},

userConfig(): UserConfig {
return this.userConfigStore.userConfig
},
Expand Down Expand Up @@ -614,15 +624,6 @@ export default defineComponent({
this.fetchContent()
}
},
/**
* Handle search event from unified search.
*
* @param searchEvent is event object.
*/
onSearch: debounce(function(searchEvent) {
console.debug('Files app handling search event from unified search...', searchEvent)
this.filterText = searchEvent.query
}, 500),

/**
* Reset the search query
Expand Down

0 comments on commit 409b2ba

Please sign in to comment.