Skip to content

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

feat: properly clear out editor on logout

thecodrr9fba6dd20f0d
diff --git a/apps/web/src/stores/editor-store.js b/apps/web/src/stores/editor-store.js
index f78bcc7b3..1d0891015 100644
--- a/apps/web/src/stores/editor-store.js
+++ b/apps/web/src/stores/editor-store.js
@@ -46,7 +46,7 @@ class EditorStore extends BaseStore {
if (note) await this.openSession(note);
});
- EV.subscribe("user:loggedOut", () => this.clearSession());
+ EV.subscribe("user:loggedOut", () => this.get().newSession());
};
openLastSession = () => {
@@ -158,9 +158,10 @@ class EditorStore extends BaseStore {
clearSession = () => {
appStore.setIsEditorOpen(false);
- this.set(function (state) {
+ this.set((state) => {
state.session = {
...DEFAULT_SESSION,
+ state: SESSION_STATES.new,
};
});
saveLastOpenedNote();