From 21e4780027dcbd0235f356ee66b195b8f8c691c8 Mon Sep 17 00:00:00 2001 From: Ruben van der Linde Date: Sun, 11 Aug 2024 13:28:07 +0200 Subject: [PATCH] Debounced search --- src/sidebars/search/SearchSideBar.vue | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/sidebars/search/SearchSideBar.vue b/src/sidebars/search/SearchSideBar.vue index c2ff11ed..033a72b6 100644 --- a/src/sidebars/search/SearchSideBar.vue +++ b/src/sidebars/search/SearchSideBar.vue @@ -41,6 +41,7 @@ import { NcAppSidebar, NcAppSidebarTab, NcTextField, NcNoteCard, NcCheckboxRadio import Magnify from 'vue-material-design-icons/Magnify.vue' import DatabaseOutline from 'vue-material-design-icons/DatabaseOutline.vue' import FileTreeOutline from 'vue-material-design-icons/FileTreeOutline.vue' +import { debounce } from 'lodash' export default { name: 'SearchSideBar', @@ -66,11 +67,12 @@ export default { } }, watch: { - search: { - handler(search) { - searchStore.getSearchResults() - }, - }, + search: 'debouncedSearch', + }, + methods: { + debouncedSearch: debounce(function() { + searchStore.getSearchResults() + }, 500), }, }