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: restoring locked session doesn't update content
Abdullah Atta5fb91d922917
diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsxindex dda5df1a0..a3946d900 100644--- a/apps/web/src/components/editor/index.tsx+++ b/apps/web/src/components/editor/index.tsx@@ -388,7 +388,6 @@ function PreviewModeNotice(props: PreviewModeNoticeProps) {px={4}onClick={async () => {await disablePreviewMode(false);- await editorstore.get().saveSession();}}>Restorediff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.jsindex c6f619fa5..349d8613e 100644--- a/apps/web/src/stores/editor-store.js+++ b/apps/web/src/stores/editor-store.js@@ -139,6 +139,11 @@ class EditorStore extends BaseStore {};saveSession = async (sessionId, session) => {+ if (!session) {+ logger.warn("Session cannot be undefined", { sessionId, session });+ return;+ }+const currentSession = this.get().session;if (currentSession.readonly && session.readonly !== false) return; // do not allow saving of readonly sessionif (currentSession.saveState === 0 && !currentSession.id && !sessionId)@@ -185,7 +190,7 @@ class EditorStore extends BaseStore {if (!!state.session.id && state.session.id !== note.id) return;for (let key in session) {- if (key === "content") continue;+ if (key === "content" && !state.session.locked) continue;state.session[key] = session[key];}@@ -200,8 +205,8 @@ class EditorStore extends BaseStore {this.setSaveState(1);} catch (err) {this.setSaveState(-1);- logger.info(err);- if (session.locked) {+ logger.error(err);+ if (currentSession.locked) {hashNavigate(`/notes/${session.id}/unlock`, { replace: true });}}