From 15ddeb94c78c900e018019e5df581779eb96ceed Mon Sep 17 00:00:00 2001 From: hamid zarghami Date: Wed, 22 Apr 2026 12:25:15 +0330 Subject: [PATCH] select first category --- public/61811896.txt | 0 src/app/[name]/(Main)/page.tsx | 11 +++++++++++ 2 files changed, 11 insertions(+) delete mode 100644 public/61811896.txt diff --git a/public/61811896.txt b/public/61811896.txt deleted file mode 100644 index e69de29..0000000 diff --git a/src/app/[name]/(Main)/page.tsx b/src/app/[name]/(Main)/page.tsx index ece8712..7eb68d6 100644 --- a/src/app/[name]/(Main)/page.tsx +++ b/src/app/[name]/(Main)/page.tsx @@ -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;