Skip to content

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

fix: crash in tags due to old menu logic

thecodrr60c7375fdf2f
diff --git a/apps/web/src/components/tag/index.js b/apps/web/src/components/tag/index.js
index 4b1999ea5..40a28fd2a 100644
--- a/apps/web/src/components/tag/index.js
+++ b/apps/web/src/components/tag/index.js
@@ -5,12 +5,11 @@ import { Text } from "rebass";
import { store as appStore } from "../../stores/app-store";
import { db } from "../../common/db";
-const menuItems = (item) => [
+const menuItems = [
{
- title: db.settings.isPinned(item.id)
- ? "Remove shortcut"
- : "Create shortcut",
- onClick: () => appStore.pinItemToMenu(item),
+ title: ({ tag }) =>
+ db.settings.isPinned(tag.id) ? "Remove shortcut" : "Create shortcut",
+ onClick: ({ tag }) => appStore.pinItemToMenu(tag),
},
];
@@ -23,7 +22,7 @@ function Tag({ item, index }) {
index={index}
title={<TagNode title={title} />}
footer={<Text variant="subBody">{noteIds.length} notes</Text>}
- menuItems={menuItems(item)}
+ menu={{ items: menuItems, extraData: { tag: item } }}
onClick={() => {
navigate(`/tags/${id}`);
}}