From 1ad29077e34c87e227c2f384dbd1c6f6ffcec9a8 Mon Sep 17 00:00:00 2001 From: Faisal Amir Date: Wed, 20 Aug 2025 14:16:45 +0700 Subject: [PATCH] fix: hiden sort filter when searching model --- web-app/src/routes/hub/index.tsx | 91 +++++++++++++++++--------------- 1 file changed, 47 insertions(+), 44 deletions(-) diff --git a/web-app/src/routes/hub/index.tsx b/web-app/src/routes/hub/index.tsx index ffacd2f04..e873baa77 100644 --- a/web-app/src/routes/hub/index.tsx +++ b/web-app/src/routes/hub/index.tsx @@ -146,14 +146,16 @@ function Hub() { } // Apply downloaded filter if (showOnlyDownloaded) { - filtered = filtered?.map((model) => ({ - ...model, - quants: model.quants.filter((variant) => - llamaProvider?.models.some( - (m: { id: string }) => m.id === variant.model_id - ) - ) - })).filter((model) => model.quants.length > 0) + filtered = filtered + ?.map((model) => ({ + ...model, + quants: model.quants.filter((variant) => + llamaProvider?.models.some( + (m: { id: string }) => m.id === variant.model_id + ) + ), + })) + .filter((model) => model.quants.length > 0) } // Add HuggingFace repo at the beginning if available if (huggingFaceRepo) { @@ -428,43 +430,44 @@ function Hub() { const isLastStep = currentStepIndex === steps.length - 1 const renderFilter = () => { - return ( - <> - - - - { - sortOptions.find((option) => option.value === sortSelected) - ?.name - } + if (searchValue.length === 0) + return ( + <> + + + + { + sortOptions.find((option) => option.value === sortSelected) + ?.name + } + + + + {sortOptions.map((option) => ( + setSortSelected(option.value)} + > + {option.name} + + ))} + + +
+ + + {t('hub:downloaded')} - - - {sortOptions.map((option) => ( - setSortSelected(option.value)} - > - {option.name} - - ))} - - -
- - - {t('hub:downloaded')} - -
- - ) +
+ + ) } return (