Skip to content

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

web: remove locked session type guard (switch to simple boolean)

Abdullah Atta5985e227777b
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts
index f57b7cb95..ed870284a 100644
--- a/apps/web/src/stores/editor-store.ts
+++ b/apps/web/src/stores/editor-store.ts
@@ -128,11 +128,7 @@ type SessionTypeMap = {
deleted: DeletedEditorSession;
};
-export function isLockedSession(session: EditorSession): session is
- | LockedEditorSession
- // TODO: | DefaultEditorSession
- | DeletedEditorSession
- | ConflictedEditorSession {
+export function isLockedSession(session: EditorSession): boolean {
return (
session.type === "locked" ||
("content" in session &&
@@ -175,12 +171,16 @@ class EditorStore extends BaseStore<EditorStore> {
EV.subscribe(EVENTS.vaultLocked, () => {
this.set((state) => {
state.sessions = state.sessions.map((session) => {
- console.log("REFRESHIGN", session);
if (isLockedSession(session)) {
- if (session.type === "diff" || session.type === "deleted")
+ if (
+ session.type === "diff" ||
+ session.type === "deleted" ||
+ // TODO: what's this?
+ !("note" in session)
+ )
return session;
- return {
+ return <LockedEditorSession>{
type: "locked",
id: session.id,
note: session.note,