Skip to content

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

fix: auto close note on logout

thecodrr5164bf4414ff
diff --git a/apps/web/src/app-effects.js b/apps/web/src/app-effects.js
index ac5349196..8baf1b4e4 100644
--- a/apps/web/src/app-effects.js
+++ b/apps/web/src/app-effects.js
@@ -4,6 +4,7 @@ import { useStore as useUserStore } from "./stores/user-store";
import { useStore as useNotesStore } from "./stores/note-store";
import { useStore as useThemeStore } from "./stores/theme-store";
import { useStore as useAttachmentStore } from "./stores/attachment-store";
+import { useStore as useEditorStore } from "./stores/editor-store";
import { resetReminders } from "./common/reminders";
import { introduceFeatures, showUpgradeReminderDialogs } from "./common";
import { AppEventManager, AppEvents } from "./common/app-events";
@@ -11,7 +12,6 @@ import { db } from "./common/db";
import { CHECK_IDS, EV, EVENTS } from "@streetwriters/notesnook-core/common";
import { registerKeyMap } from "./common/key-map";
import { isUserPremium } from "./hooks/use-is-user-premium";
-import { loadTrackerScript } from "./utils/analytics";
import useAnnouncements from "./utils/use-announcements";
import {
showAnnouncementDialog,
@@ -39,6 +39,7 @@ export default function AppEffects({ setShow }) {
const setIsVaultCreated = useStore((store) => store.setIsVaultCreated);
const setTheme = useThemeStore((store) => store.setTheme);
const followSystemTheme = useThemeStore((store) => store.followSystemTheme);
+ const initEditorStore = useEditorStore((store) => store.init);
const [announcements, remove] = useAnnouncements("dialog");
const isSystemThemeDark = useSystemTheme();
@@ -72,6 +73,8 @@ export default function AppEffects({ setShow }) {
initAttachments();
refreshNavItems();
initNotes();
+ initEditorStore();
+
(async function () {
await updateLastSynced();
if (await initUser()) {
@@ -83,11 +86,13 @@ export default function AppEffects({ setShow }) {
await showOnboardingDialog(interruptedOnboarding());
await showFeatureDialog("highlights");
})();
+
return () => {
userCheckStatusEvent.unsubscribe();
};
},
[
+ initEditorStore,
initStore,
initAttachments,
sync,
diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx
index a6c915ef2..3d402e744 100644
--- a/apps/web/src/components/editor/index.tsx
+++ b/apps/web/src/components/editor/index.tsx
@@ -74,8 +74,6 @@ export default function EditorManager({
const isReadonly = useStore(
(store) => store.session.readonly || !!previewSession.current
);
- // TODO move this somewhere more appropriate
- // const init = useStore((store) => store.init);
const openSession = useCallback(async (noteId) => {
await editorstore.get().openSession(noteId);