From 17431e4ecb49b109f722d3e7feafe91dc3f44d20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yoann=20Rodi=C3=A8re?= Date: Mon, 15 Jan 2024 11:48:03 +0100 Subject: [PATCH] Fix search returning no results after explicitly selecting "All categories" --- assets/javascript/guides-app.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/assets/javascript/guides-app.js b/assets/javascript/guides-app.js index b8b0a4b0db1..28b9ed70fdc 100644 --- a/assets/javascript/guides-app.js +++ b/assets/javascript/guides-app.js @@ -69,12 +69,18 @@ const app = createApp({ }, category: { get() { - // Turn null to "", because that's how the select box refers to "all categories" + // Turn "no entry" into "", because that's how the select box refers to "all categories" return this.search.input.categories || "" }, set(val) { - // Turn "" to null, because that's how the search service refers to "all categories" - this.search.input.categories = val || null + if (val) { + this.search.input.categories = val + } + // Turn null/"" into "no entry", because not specifying the category + // is how we get the search service to return all categories + else { + delete this.search.input.categories + } } }, hasInput() {