From 8999a36eafed41fc6e37a6996571dd47378e348f Mon Sep 17 00:00:00 2001 From: Sergey Yarkov Date: Sat, 22 Jan 2022 19:25:32 +0300 Subject: [PATCH] fix: set selected category to null on first render --- .../courses/components/CategoryList/CategoryList.tsx | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/src/pages/courses/components/CategoryList/CategoryList.tsx b/src/pages/courses/components/CategoryList/CategoryList.tsx index 000fcc8..059bfa7 100644 --- a/src/pages/courses/components/CategoryList/CategoryList.tsx +++ b/src/pages/courses/components/CategoryList/CategoryList.tsx @@ -12,15 +12,10 @@ import { CategoryItemPropsType } from './CategoryItem'; */ import CategoryListLoading from './CategoryListLoading'; -/** - * Contexts - */ -import { CoursesPageContext } from '@educt/contexts'; - /** * Hooks */ -import { useContext, useEffect } from 'react'; +import { useEffect } from 'react'; import { useRootStore } from '@educt/hooks/useRootStore'; import { useErrorHandler } from 'react-error-boundary'; @@ -43,6 +38,8 @@ const CategoryList: React.FC = ({ render: Item }) => { categoryStore.loadCategories().catch(error => handleError(error)); }, [categoryStore, handleError]); + useEffect(() => coursesStore.setSelectedCategory(null), []); + /** * Loading */