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: title-only note not getting added to list
thecodrra0b4d0ae8a9b
diff --git a/apps/web/__e2e__/notes.test.js b/apps/web/__e2e__/notes.test.jsindex efe880a27..16bfedbea 100644--- a/apps/web/__e2e__/notes.test.js+++ b/apps/web/__e2e__/notes.test.js@@ -494,7 +494,7 @@ test.describe("run tests independently", () => {expect(await getEditorContent()).toBe("");});- test.only("creating a new note should clear the word count", async () => {+ test("creating a new note should clear the word count", async () => {const selector = await createNoteAndCheckPresence();await page.click(getTestId("notes-action-button"));@@ -507,6 +507,16 @@ test.describe("run tests independently", () => {"0 words");});++ test.only("creating a new title-only note should add it to the list", async () => {+ const selector = await createNoteAndCheckPresence();++ await page.click(getTestId("notes-action-button"));++ await page.click(selector);++ await createNoteAndCheckPresence({ title: "Hello World" });+ });});test.describe("stress tests", () => {diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.jsindex 2dc8230b4..0d9e780d2 100644--- a/apps/web/src/stores/editor-store.js+++ b/apps/web/src/stores/editor-store.js@@ -6,6 +6,7 @@ import { db } from "../common/db";import BaseStore from ".";import { EV, EVENTS } from "notes-core/common";import { hashNavigate } from "../navigation";+import { qclone } from "qclone";const SESSION_STATES = {stale: "stale",@@ -155,7 +156,10 @@ class EditorStore extends BaseStore {db.attachments.ofNote(note.id, "files") || [];});- if (note.headline !== session.headline || note.title !== session.title)+ if (+ note.headline !== oldSession.headline ||+ note.title !== oldSession.title+ )noteStore.refresh();if (!oldSession?.id) {@@ -204,13 +208,13 @@ class EditorStore extends BaseStore {};setSession = (set) => {- const oldSession = this.get().session;+ const oldSession = qclone(this.get().session);this.set(set);- this.saveSession(oldSession);+ this.get().saveSession(oldSession);};setSessionContent = (content) => {- const oldSession = this.get().session;+ const oldSession = qclone(this.get().session);this.get().session.content = content;this.saveSession(oldSession);};