diff --git a/apps/client/src/widgets/note_icon.ts.bak b/apps/client/src/widgets/note_icon.ts.bak index 52ff60247..0fd2b7c1f 100644 --- a/apps/client/src/widgets/note_icon.ts.bak +++ b/apps/client/src/widgets/note_icon.ts.bak @@ -64,7 +64,6 @@ export default class NoteIconWidget extends NoteContextAwareWidget { ); } - const search = String(this.$iconSearch.val())?.trim()?.toLowerCase(); this.$iconSearch.focus(); } diff --git a/apps/client/src/widgets/note_icon.tsx b/apps/client/src/widgets/note_icon.tsx index 2709003f1..152dd6240 100644 --- a/apps/client/src/widgets/note_icon.tsx +++ b/apps/client/src/widgets/note_icon.tsx @@ -62,14 +62,16 @@ function NoteIconList() { // Filter by text and/or category. let icons: Icon[] = fullIconData.icons; - if (search || categoryId) { + const processedSearch = search?.trim()?.toLowerCase(); + if (processedSearch || categoryId) { icons = icons.filter((icon) => { if (categoryId !== "0" && String(icon.category_id) !== categoryId) { return false; } - if (search) { - if (!icon.name.includes(search) && !icon.term?.find((t) => t.includes(search))) { + if (processedSearch) { + if (!icon.name.includes(processedSearch) && + !icon.term?.find((t) => t.includes(processedSearch))) { return false; } }