Skip to content

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

web: use sqlite for storing editor session data

Abdullah Attac98bddd35baa
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts
index ecca2da77..0abb81cce 100644
--- a/apps/web/src/stores/editor-store.ts
+++ b/apps/web/src/stores/editor-store.ts
@@ -42,7 +42,7 @@ import { NoteContent } from "@notesnook/core/dist/collections/session-content";
import { Context } from "../components/list-container/types";
import { showToast } from "../utils/toast";
import { getId } from "@notesnook/core/dist/utils/id";
-import { createJSONStorage } from "zustand/middleware";
+import { PersistStorage } from "zustand/middleware";
import { getFormattedHistorySessionDate } from "@notesnook/common";
import { isCipher } from "@notesnook/core/dist/database/crypto";
import { hashNavigate } from "../navigation";
@@ -976,7 +976,7 @@ const useEditorStore = createPersistedStore(EditorStore, {
return sessions;
}, [] as EditorSession[])
}),
- storage: createJSONStorage(() => localStorage)
+ storage: db.config() as PersistStorage<Partial<EditorStore>>
});
export { useEditorStore, SESSION_STATES };