mirror of
https://github.com/supermemoryai/supermemory.git
synced 2026-04-28 03:29:59 +00:00
perf: use Set for O(1) category lookup in facet render loop (#835)
This commit is contained in:
parent
d8b969ce78
commit
ba4bc33a50
1 changed files with 5 additions and 1 deletions
|
|
@ -191,6 +191,10 @@ export function MemoriesGrid({
|
|||
"categories",
|
||||
categoriesParam,
|
||||
)
|
||||
const selectedCategoriesSet = useMemo(
|
||||
() => new Set(selectedCategories),
|
||||
[selectedCategories],
|
||||
)
|
||||
|
||||
const { data: facetsData } = useQuery({
|
||||
queryKey: ["document-facets", effectiveContainerTags],
|
||||
|
|
@ -439,7 +443,7 @@ export function MemoriesGrid({
|
|||
className={cn(
|
||||
dmSansClassName(),
|
||||
"rounded-full border border-[#161F2C] bg-[#0D121A] px-2.5 py-1 text-xs h-auto hover:bg-[#00173C] hover:border-[#2261CA33]",
|
||||
selectedCategories.includes(facet.category) &&
|
||||
selectedCategoriesSet.has(facet.category) &&
|
||||
"bg-[#00173C] border-[#2261CA33]",
|
||||
)}
|
||||
onClick={() => handleCategoryToggle(facet.category)}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue