Skip to content

Commit

Permalink
Fix search returning no results after explicitly selecting "All categ…
Browse files Browse the repository at this point in the history
…ories"
  • Loading branch information
yrodiere committed Jan 15, 2024
1 parent 59b0526 commit 17431e4
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions assets/javascript/guides-app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand Down

0 comments on commit 17431e4

Please sign in to comment.