Просмотр исходного кода

Merge branch 'imprv/gw7848-imprv-bookmarks-content-on-user-page' into feat/gw7910-add-bookmark-from-sub-navigation

jam411 3 лет назад
Родитель
Сommit
88de92519b
1 измененных файлов с 3 добавлено и 3 удалено
  1. 3 3
      packages/app/src/components/Bookmarks/BookmarkFolderItem.tsx

+ 3 - 3
packages/app/src/components/Bookmarks/BookmarkFolderItem.tsx

@@ -1,5 +1,5 @@
 import {
-  FC, useCallback, useEffect, useState,
+  FC, useCallback, useEffect, useState, useMemo,
 } from 'react';
 
 import { useTranslation } from 'next-i18next';
@@ -42,7 +42,7 @@ const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkFolderIt
   const { data: currentPage } = useSWRxCurrentPage();
   const { mutate: mutateBookmarkInfo } = useSWRBookmarkInfo(currentPage?._id);
 
-  const getChildCount = useCallback((): number => {
+  const childCount = useMemo((): number => {
     if (currentChildren != null && currentChildren.length > children.length) {
       return currentChildren.length;
     }
@@ -193,7 +193,7 @@ const BookmarkFolderItem: FC<BookmarkFolderItemProps> = (props: BookmarkFolderIt
             </div>
             {hasChildren() && (
               <div className="grw-foldertree-count-wrapper">
-                <CountBadge count={ getChildCount() } />
+                <CountBadge count={ childCount } />
               </div>
             )}
           </>