Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

add check for tag item undefined

ammarahm-ed9fa39bfa69a6
diff --git a/apps/mobile/src/components/NoteItem/index.js b/apps/mobile/src/components/NoteItem/index.js
index 928818c7b..7b6b9a461 100644
--- a/apps/mobile/src/components/NoteItem/index.js
+++ b/apps/mobile/src/components/NoteItem/index.js
@@ -85,6 +85,8 @@ const NoteItem = ({item, isTrash, tags}) => {
if (!notebook) return [];
let topic = notebook.topics.topic(item_notebook.topics[0])?._topic;
+ if (!topic) return [];
+
notebook = notebook.data;
return [
@@ -95,11 +97,7 @@ const NoteItem = ({item, isTrash, tags}) => {
}
];
}
-
- useEffect(() => {
- console.log('rendering',item.id);
- })
-
+
return (
<>
<View
diff --git a/apps/mobile/src/components/SimpleList/index.js b/apps/mobile/src/components/SimpleList/index.js
index f55cf078c..b680b9250 100644
--- a/apps/mobile/src/components/SimpleList/index.js
+++ b/apps/mobile/src/components/SimpleList/index.js
@@ -29,17 +29,22 @@ const RenderItem = ({item, index}, ...restArgs) => {
const Item = renderItems[item.itemType || item.type] || View;
let tags =
- item.tags?.slice(0, 3)?.map(item => {
- let tag = db.tags.tag(item);
- return {
- title:tag.title,
- id:tag.id,
- alias:tag.alias
- }
- }) || [];
+ item.tags
+ ?.slice(0, 3)
+ ?.map(item => {
+ let tag = db.tags.tag(item);
+
+ if (!tag) return null;
+ return {
+ title: tag.title,
+ id: tag.id,
+ alias: tag.alias
+ };
+ })
+ .filter(t => t !== null) || [];
return <Item item={item} tags={tags} index={index} {...restArgs} />;
-}
+};
const SimpleList = ({
listData,