mirror of
https://github.com/sergeyyarkov/educt-client.git
synced 2026-10-11 18:29:15 +03:00
fix: set selected category to null on first render
This commit is contained in:
parent
3529993b8a
commit
8999a36eaf
@ -12,15 +12,10 @@ import { CategoryItemPropsType } from './CategoryItem';
|
|||||||
*/
|
*/
|
||||||
import CategoryListLoading from './CategoryListLoading';
|
import CategoryListLoading from './CategoryListLoading';
|
||||||
|
|
||||||
/**
|
|
||||||
* Contexts
|
|
||||||
*/
|
|
||||||
import { CoursesPageContext } from '@educt/contexts';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Hooks
|
* Hooks
|
||||||
*/
|
*/
|
||||||
import { useContext, useEffect } from 'react';
|
import { useEffect } from 'react';
|
||||||
import { useRootStore } from '@educt/hooks/useRootStore';
|
import { useRootStore } from '@educt/hooks/useRootStore';
|
||||||
import { useErrorHandler } from 'react-error-boundary';
|
import { useErrorHandler } from 'react-error-boundary';
|
||||||
|
|
||||||
@ -43,6 +38,8 @@ const CategoryList: React.FC<CategoryListPropsType> = ({ render: Item }) => {
|
|||||||
categoryStore.loadCategories().catch(error => handleError(error));
|
categoryStore.loadCategories().catch(error => handleError(error));
|
||||||
}, [categoryStore, handleError]);
|
}, [categoryStore, handleError]);
|
||||||
|
|
||||||
|
useEffect(() => coursesStore.setSelectedCategory(null), []);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Loading
|
* Loading
|
||||||
*/
|
*/
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user