update filter

This commit is contained in:
2025-12-10 13:54:28 -03:00
parent cea6322976
commit 293537800c
2 changed files with 249 additions and 34 deletions

View File

@@ -161,7 +161,7 @@ function List({ s, hits = [] }: { s: string; hits: Enrollment[] }) {
})
}, [hits])
const hits_ = useMemo(() => {
const filtered = useMemo(() => {
if (!s) {
return hits
}
@@ -169,7 +169,7 @@ function List({ s, hits = [] }: { s: string; hits: Enrollment[] }) {
return fuse.search(s).map(({ item }) => item)
}, [s, fuse, hits])
if (hits_.length === 0) {
if (filtered.length === 0) {
return (
<Empty className="border border-dashed">
<EmptyHeader>
@@ -199,7 +199,7 @@ function List({ s, hits = [] }: { s: string; hits: Enrollment[] }) {
return (
<div className="grid lg:grid-cols-4 gap-5">
{hits_.map((props: Enrollment, idx) => {
{filtered.map((props: Enrollment, idx) => {
return <Enrollment key={idx} {...props} />
})}
</div>