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
web: get fresh note context when saving a new note
Abdullah Attae19e9eb96f18
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.tsindex 950152ba1..cd8daf419 100644--- a/apps/web/src/stores/editor-store.ts+++ b/apps/web/src/stores/editor-store.ts@@ -39,7 +39,6 @@ import {isTrashItem,NoteContent} from "@notesnook/core";-import { Context } from "../components/list-container/types";import { showToast } from "../utils/toast";import { getId } from "@notesnook/core";import { PersistStorage } from "zustand/middleware";@@ -121,7 +120,6 @@ export type DefaultEditorSession = BaseEditorSession & {export type NewEditorSession = BaseEditorSession & {type: "new";- context?: Context;saveState: SaveState;content?: NoteContent<false>;};@@ -908,13 +906,14 @@ class EditorStore extends BaseStore<EditorStore> {if (!note) throw new Error("Note not saved.");if (currentSession.type === "new") {- if (currentSession.context) {- const { type } = currentSession.context;+ const context = useNoteStore.getState().context;+ if (context) {+ const { type } = context;if (type === "notebook")- await db.notes.addToNotebook(currentSession.context.id, noteId);+ await db.notes.addToNotebook(context.id, noteId);else if (type === "color" || type === "tag")await db.relations.add(- { type, id: currentSession.context.id },+ { type, id: context.id },{ id, type: "note" });} else {@@ -1015,7 +1014,6 @@ class EditorStore extends BaseStore<EditorStore> {type: "new",id: sessionId,tabId: activeTabId,- context: useNoteStore.getState().context,saveState: SaveState.NotSaved});};