1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-07-24 21:39:36 +02:00

Fixed state bug while updating categories. Fixed bug with bookmarks not being displayed under categories.

This commit is contained in:
Paweł Malak 2021-11-09 15:51:50 +01:00
parent 0d5a4c418e
commit f127a354ef
5 changed files with 18 additions and 14 deletions

View file

@ -41,8 +41,6 @@ export const Bookmarks = (props: Props): JSX.Element => {
const dispatch = useDispatch();
const { getCategories } = bindActionCreators(actionCreators, dispatch);
const { searching = false } = props;
const [modalIsOpen, setModalIsOpen] = useState(false);
const [formContentType, setFormContentType] = useState(ContentType.category);
const [isInEdit, setIsInEdit] = useState(false);
@ -56,10 +54,10 @@ export const Bookmarks = (props: Props): JSX.Element => {
useState<Bookmark>(bookmarkTemplate);
useEffect(() => {
if (categories.length === 0) {
if (!categories.length) {
getCategories();
}
}, [getCategories]);
}, []);
const toggleModal = (): void => {
setModalIsOpen(!modalIsOpen);
@ -148,7 +146,7 @@ export const Bookmarks = (props: Props): JSX.Element => {
{loading ? (
<Spinner />
) : !isInEdit ? (
<BookmarkGrid categories={categories} searching />
<BookmarkGrid categories={categories} searching={props.searching} />
) : (
<BookmarkTable
contentType={tableContentType}