select first category

This commit is contained in:
hamid zarghami
2026-04-22 12:25:15 +03:30
parent 6448b251e4
commit 15ddeb94c7
2 changed files with 11 additions and 0 deletions
View File
+11
View File
@@ -53,6 +53,17 @@ const MenuIndex = () => {
}
}, [isInitialMount, setSearch, setSelectedIngredients, setSelectedDeliveryId, setSorting]);
useEffect(() => {
console.log('selectedCategory', selectedCategory);
if (categoriesData?.data && selectedCategory === '0') {
setSelectedCategory(categoriesData?.data?.[0]?.id)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedCategory, categoriesData])
const onScroll = useCallback(() => {
if (!wrapperRef?.current?.parentElement?.parentElement?.scrollTop || !smallCategoriesRef.current?.offsetTop) return;