Skip to content

Commit

Permalink
treat clause values as arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
tsullivan committed Jul 2, 2024
1 parent 4b26bc5 commit 8b6caea
Showing 1 changed file with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,16 @@ export const parseSearchParams = (term: string): ParsedSearchParams => {

const unknownFilters = [...filterValues.entries()]
.filter(([key]) => !knownFilters.includes(key))
.reduce((unknowns, [key, value]) => {
.reduce((unknowns, [key, values]) => {
// Unknown filters must be used as part of the search term.
// Example: "remote:logs" is not a filter, it is a valid search term.
searchTerm = `${searchTerm} ${key}:${value}`;
if (Array.isArray(values) && values.length === 1) {
searchTerm = `${searchTerm} ${key}:${values[0]}`;
}

return {
...unknowns,
[key]: value,
[key]: values,
};
}, {} as Record<string, FilterValues>);

Expand Down

0 comments on commit 8b6caea

Please sign in to comment.