From cc032633a2c4fc203c42810f0d50dffe8b4020da Mon Sep 17 00:00:00 2001 From: mehditorabiv Date: Thu, 19 Sep 2024 17:33:02 +0300 Subject: [PATCH] fix type issue --- src/components/global/FilterByCategory.tsx | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/components/global/FilterByCategory.tsx b/src/components/global/FilterByCategory.tsx index 538268af..2a445f4b 100644 --- a/src/components/global/FilterByCategory.tsx +++ b/src/components/global/FilterByCategory.tsx @@ -1,3 +1,4 @@ +/* eslint-disable react/jsx-key */ import { Alert, Box, @@ -190,7 +191,10 @@ const FilterByCategory = ({ open={false} value={selectedCategories} onChange={(event, newValue) => { - setSelectedCategories(newValue); + const filteredCategories = newValue.filter( + (value): value is ICategory => typeof value !== 'string' + ); + setSelectedCategories(filteredCategories); }} onInputChange={(event, value) => { setSearchQuery(value); @@ -258,7 +262,7 @@ const FilterByCategory = ({ className='mt-3 max-h-[300px] overflow-y-auto rounded-lg border border-gray-300' onScroll={handleScroll} > - {initialLoading ? ( // Only show the spinner on the first load + {initialLoading ? (