Skip to content

Commit

Permalink
fix(icons): picker does not allow multiple words (#1827)
Browse files Browse the repository at this point in the history
  • Loading branch information
Meierschlumpf authored Jan 2, 2025
1 parent ca39ca6 commit 6e21863
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/api/src/router/icons.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { count, like } from "@homarr/db";
import { and, count, like } from "@homarr/db";
import { icons } from "@homarr/db/schema";
import { validation } from "@homarr/validation";

Expand All @@ -15,7 +15,11 @@ export const iconsRouter = createTRPCRouter({
name: true,
url: true,
},
where: (input.searchText?.length ?? 0) > 0 ? like(icons.name, `%${input.searchText}%`) : undefined,
where:
(input.searchText?.length ?? 0) > 0
? // eslint-disable-next-line @typescript-eslint/no-non-null-assertion
and(...input.searchText!.split(" ").map((keyword) => like(icons.name, `%${keyword}%`)))
: undefined,
limit: input.limitPerGroup,
},
},
Expand Down

0 comments on commit 6e21863

Please sign in to comment.