From b114754da7a302a496ba1758bb41341d89fffabc Mon Sep 17 00:00:00 2001 From: Liam Dyer Date: Fri, 17 Apr 2020 12:37:37 -0400 Subject: [PATCH 1/5] Decrease debounce on search to 150ms --- pages/search.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/search.vue b/pages/search.vue index 987d9e5..c3b34aa 100644 --- a/pages/search.vue +++ b/pages/search.vue @@ -48,7 +48,7 @@ export default { keywords: keywords && R.split(',', keywords), tags: tags && R.split(',', tags), } - }, 500) + }, 150) }, searchInput(searchInput) { this.resources = this.$store.getters['data/findBySearchInputs'](searchInput.keywords, searchInput.tags) From ee06cb0caf913952b1589fd44ef28abaa9b109bc Mon Sep 17 00:00:00 2001 From: Liam Dyer Date: Fri, 17 Apr 2020 12:58:51 -0400 Subject: [PATCH 2/5] Load search from query --- components/Search.vue | 13 +++++++++++-- pages/search.vue | 7 +++++++ 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/components/Search.vue b/components/Search.vue index 5bc4360..21abe33 100644 --- a/components/Search.vue +++ b/components/Search.vue @@ -32,12 +32,21 @@ export default { const searchParams = new URLSearchParams() if (isNotEmpty(titles)) searchParams.append('keywords', titles) - if (isNotEmpty(tags)) + if (isNotEmpty(tags)) searchParams.append('tags', R.map(this.removeFirstChar, tags)) - + this.$router.push(this.searchPath + '?' + searchParams.toString()) }, }, + mounted() { + let keywords = this.$route.query.keywords || '' + keywords = keywords.split(',').join(' ') + + let tags = this.$route.query.tags || '' + tags = R.filter(this.isTag, tags.split(',')).map(tag => `#${tag}`).join(' ') + + this.searchInput = `${tags} ${keywords}`.trim() + }, } diff --git a/pages/search.vue b/pages/search.vue index c3b34aa..b9bdc2e 100644 --- a/pages/search.vue +++ b/pages/search.vue @@ -56,6 +56,13 @@ export default { }, mounted() { this.showTitle = true + + const keywords = this.$route.query.keywords + const tags = this.$route.query.tags + this.searchInput = { + keywords: keywords && R.split(',', keywords), + tags: tags && R.split(',', tags), + } }, methods: { async createCopyUrl(resource) { From 3a4f384517aadf7920bf4829beb8fb8d068f4704 Mon Sep 17 00:00:00 2001 From: Liam Dyer Date: Fri, 17 Apr 2020 13:01:11 -0400 Subject: [PATCH 3/5] Reduce debounce time to 100ms --- pages/search.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/search.vue b/pages/search.vue index b9bdc2e..7767d6e 100644 --- a/pages/search.vue +++ b/pages/search.vue @@ -48,7 +48,7 @@ export default { keywords: keywords && R.split(',', keywords), tags: tags && R.split(',', tags), } - }, 150) + }, 100) }, searchInput(searchInput) { this.resources = this.$store.getters['data/findBySearchInputs'](searchInput.keywords, searchInput.tags) From c77e9072f52a48a09c062394f5a89d0bdf6e4d75 Mon Sep 17 00:00:00 2001 From: Liam Dyer Date: Sat, 18 Apr 2020 10:17:09 -0400 Subject: [PATCH 4/5] Increase debounce time to 300ms MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: wellá --- pages/search.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pages/search.vue b/pages/search.vue index 7767d6e..c998fd8 100644 --- a/pages/search.vue +++ b/pages/search.vue @@ -48,7 +48,7 @@ export default { keywords: keywords && R.split(',', keywords), tags: tags && R.split(',', tags), } - }, 100) + }, 300) }, searchInput(searchInput) { this.resources = this.$store.getters['data/findBySearchInputs'](searchInput.keywords, searchInput.tags) From 11b67a8bfcc764cee04baa4b1f37232afde85d25 Mon Sep 17 00:00:00 2001 From: Liam Dyer Date: Sat, 18 Apr 2020 10:35:47 -0400 Subject: [PATCH 5/5] Enter listener on Search --- components/Search.vue | 6 +++++- pages/search.vue | 9 +++++++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/components/Search.vue b/components/Search.vue index 21abe33..c77ac29 100644 --- a/components/Search.vue +++ b/components/Search.vue @@ -1,5 +1,5 @@