From 78dac98194f09f4fb581df62ba5a99f9c952eac6 Mon Sep 17 00:00:00 2001 From: Alzer Del Zeyger <75466035+Dx-Alz-xD@users.noreply.github.com> Date: Wed, 11 Nov 2026 22:01:47 +0530 Subject: [PATCH] fix(search): drop the stray log and the sort that always gave NaN the search bar logged the whole subject list on every load, and both search bars sorted results by score although fuse was set up without includeScore, so every comparison was Infinity - Infinity. fuse already returns the best matches first, so the sort goes --- src/components/Searchbar/pinned-searchbar.tsx | 1 - src/components/Searchbar/searchbar-child.tsx | 2 -- 2 files changed, 3 deletions(-) diff --git a/src/components/Searchbar/pinned-searchbar.tsx b/src/components/Searchbar/pinned-searchbar.tsx index f70f3b4..1a64d0e 100644 --- a/src/components/Searchbar/pinned-searchbar.tsx +++ b/src/components/Searchbar/pinned-searchbar.tsx @@ -40,7 +40,6 @@ function PinnedSearchBar({ if (text.length > 1 && initialSubjects.length > 0) { const filteredSuggestions = fuzzy .search(text) - .sort((a, b) => (a.score ?? Infinity) - (b.score ?? Infinity)) .map((res) => res.item.name) .slice(0, 10); diff --git a/src/components/Searchbar/searchbar-child.tsx b/src/components/Searchbar/searchbar-child.tsx index f6170d3..1ac2e68 100644 --- a/src/components/Searchbar/searchbar-child.tsx +++ b/src/components/Searchbar/searchbar-child.tsx @@ -38,7 +38,6 @@ function SearchBarChild({ }), ); } - console.log(initialSubjects); }, [initialSubjects]); const handleSearchChange = (e: React.ChangeEvent) => { @@ -48,7 +47,6 @@ function SearchBarChild({ if (text.length > 1 && initialSubjects.length > 0) { const filteredSuggestions = fuzzy .search(text) - .sort((a, b) => (a.score ?? Infinity) - (b.score ?? Infinity)) .map((res) => res.item) .slice(0, 10);