select first category
This commit is contained in:
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user