A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: refresh notes after editing a notebook
thecodrr1abcf3b886c2
diff --git a/apps/web/src/common/dialogcontroller.js b/apps/web/src/common/dialogcontroller.jsindex 81ade3069..3fd7c486d 100644--- a/apps/web/src/common/dialogcontroller.js+++ b/apps/web/src/common/dialogcontroller.js@@ -59,6 +59,7 @@ export function showEditNotebookDialog(notebookId) {await notebookTopics.add(...topics);notebookStore.refresh();+ noteStore.refresh();appStore.refreshMenuPins();showToast("success", "Notebook edited successfully!");diff --git a/apps/web/src/common/list-profiles.js b/apps/web/src/common/list-profiles.jsindex 1c1734baa..226084d11 100644--- a/apps/web/src/common/list-profiles.js+++ b/apps/web/src/common/list-profiles.js@@ -19,8 +19,14 @@ function createProfile(item, itemHeight, estimatedItemHeight) {const NotesProfile = createProfile((index, item, context) => {+ // TODO doing all this here could be a potential performance issue.+let tags = item.tags;+ let notebook = item.notebooks[0];if (tags) tags = tags.map((t) => db.tags.tag(t)).slice(0, 2);+ if (notebook) {+ notebook = db.notebooks.notebook(notebook.id)?.data;+ }return (<Note@@ -28,7 +34,7 @@ const NotesProfile = createProfile(pinnable={!context}item={item}tags={tags || []}- notebooks={item.notebooks?.slice() || []}+ notebook={notebook}context={context}/>);diff --git a/apps/web/src/components/note/index.js b/apps/web/src/components/note/index.jsindex 794e7e0ac..ce9893ccd 100644--- a/apps/web/src/components/note/index.js+++ b/apps/web/src/components/note/index.js@@ -17,7 +17,7 @@ import Vault from "../../common/vault";import IconTag from "../icon-tag";function Note(props) {- const { tags, item, index, context } = props;+ const { tags, notebook, item, index, context } = props;const note = item;const selectedNote = useStore((store) => store.selectedNote);const viewMode = useStore((store) => store.viewMode);@@ -28,13 +28,6 @@ function Note(props) {return note.color.toLowerCase();}, [note.color]);- const notebook = useMemo(() => {- if (!note.notebooks?.length) return;- const firstNotebook = note.notebooks[0];- const notebook = db.notebooks.notebook(firstNotebook.id)?.data;- return notebook;- }, [note.notebooks]);-const isCompact = useMemo(() => viewMode === "compact", [viewMode]);return (@@ -169,8 +162,7 @@ export default React.memo(Note, function (prevProps, nextProps) {prevItem.locked === nextItem.locked &&prevItem.conflicted === nextItem.conflicted &&prevItem.color === nextItem.color &&- JSON.stringify(prevProps.notebooks) ===- JSON.stringify(nextProps.notebooks) &&+ JSON.stringify(prevProps.notebook) === JSON.stringify(nextProps.notebook) &&JSON.stringify(prevProps.tags) === JSON.stringify(nextProps.tags));});