fix: set selected category to null on first render

This commit is contained in:
Sergey Yarkov 2022-01-22 19:25:32 +03:00
parent 3529993b8a
commit 8999a36eaf

View File

@ -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<CategoryListPropsType> = ({ render: Item }) => {
categoryStore.loadCategories().catch(error => handleError(error));
}, [categoryStore, handleError]);
useEffect(() => coursesStore.setSelectedCategory(null), []);
/**
* Loading
*/