From 9ca81eb320bfedc46fcaabd2f2419a3c56741f7e Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 4 Aug 2019 21:50:54 -0400 Subject: [PATCH] Fixed: Issue searching for artist in the UI when tag is removed --- .../Page/Header/ArtistSearchInputConnector.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/frontend/src/Components/Page/Header/ArtistSearchInputConnector.js b/frontend/src/Components/Page/Header/ArtistSearchInputConnector.js index 4303d9774..214303358 100644 --- a/frontend/src/Components/Page/Header/ArtistSearchInputConnector.js +++ b/frontend/src/Components/Page/Header/ArtistSearchInputConnector.js @@ -25,9 +25,15 @@ function createCleanArtistSelector() { sortName, foreignArtistId, images, - tags: tags.map((id) => { - return allTags.find((tag) => tag.id === id); - }) + tags: tags.reduce((acc, id) => { + const matchingTag = allTags.find((tag) => tag.id === id); + + if (matchingTag) { + acc.push(matchingTag); + } + + return acc; + }, []) }; }); }