From 5f5cb2838e7cbd07623ce7381e1df4330df4797e Mon Sep 17 00:00:00 2001 From: Eliot Berriot <contact@eliotberriot.com> Date: Tue, 5 Jun 2018 20:48:54 +0200 Subject: [PATCH] Fix #278: Broken search bar on library home --- changes/changelog.d/278.bugfix | 1 + front/src/components/audio/Search.vue | 15 +++++---------- 2 files changed, 6 insertions(+), 10 deletions(-) create mode 100644 changes/changelog.d/278.bugfix diff --git a/changes/changelog.d/278.bugfix b/changes/changelog.d/278.bugfix new file mode 100644 index 0000000000..e1d831de16 --- /dev/null +++ b/changes/changelog.d/278.bugfix @@ -0,0 +1 @@ +Broken search bar on library home (#278) diff --git a/front/src/components/audio/Search.vue b/front/src/components/audio/Search.vue index 890c83f5bf..9cfea3bc0c 100644 --- a/front/src/components/audio/Search.vue +++ b/front/src/components/audio/Search.vue @@ -29,9 +29,9 @@ </template> <script> +import _ from 'lodash' import axios from 'axios' import logger from '@/logging' -import backend from '@/audio/backend' import AlbumCard from '@/components/audio/album/Card' import ArtistCard from '@/components/audio/artist/Card' @@ -50,7 +50,6 @@ export default { albums: [], artists: [] }, - backend: backend, isLoading: false } }, @@ -61,7 +60,7 @@ export default { this.search() }, methods: { - search () { + search: _.debounce(function () { if (this.query.length < 1) { return } @@ -77,15 +76,11 @@ export default { self.results = self.castResults(response.data) self.isLoading = false }) - }, + }, 500), castResults (results) { return { - albums: results.albums.map((album) => { - return backend.Album.clean(album) - }), - artists: results.artists.map((artist) => { - return backend.Artist.clean(artist) - }) + albums: results.albums, + artists: results.artists } } }, -- GitLab