Skip to content

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

perf: do not re-render all items on note selection

thecodrrf742004c5ab1
diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.js
index 0900c9819..3059fba0a 100644
--- a/apps/web/src/components/note/index.js
+++ b/apps/web/src/components/note/index.js
@@ -19,17 +19,14 @@ import IconTag from "../icon-tag";
function Note(props) {
const { tags, notebook, item, index, context } = props;
const note = item;
- const selectedNote = useStore((store) => store.selectedNote);
- const viewMode = useStore((store) => store.viewMode);
- const isOpened = selectedNote === note.id;
+ const isOpened = useStore((store) => store.selectedNote === note.id);
+ const isCompact = useStore((store) => store.viewMode === "compact");
const primary = useMemo(() => {
if (!note.color) return "primary";
return note.color.toLowerCase();
}, [note.color]);
- const isCompact = useMemo(() => viewMode === "compact", [viewMode]);
-
return (
<ListItem
selectable