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

add filter method about tag to recent changes

yuto-oweseek 4 лет назад
Родитель
Сommit
0952e9025c
1 измененных файлов с 7 добавлено и 9 удалено
  1. 7 9
      packages/app/src/components/Sidebar/RecentChanges.tsx

+ 7 - 9
packages/app/src/components/Sidebar/RecentChanges.tsx

@@ -57,15 +57,13 @@ function LargePageItem({ page }) {
 
 
   const tags = page.tags;
   const tags = page.tags;
   // when tag document is deleted from database directly tags includes null
   // when tag document is deleted from database directly tags includes null
-  const tagElements = tags.includes(null)
-    ? <></>
-    : tags.map((tag) => {
-      return (
-        <a key={tag.name} href={`/_search?q=tag:${tag.name}`} className="grw-tag-label badge badge-secondary mr-2 small">
-          {tag.name}
-        </a>
-      );
-    });
+  const tagElements = tags.filter(tag => tag != null).map((tag) => {
+    return (
+      <a key={tag.name} href={`/_search?q=tag:${tag.name}`} className="grw-tag-label badge badge-secondary mr-2 small">
+        {tag.name}
+      </a>
+    );
+  });
 
 
   return (
   return (
     <li className="list-group-item py-3 px-0">
     <li className="list-group-item py-3 px-0">