mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +01:00
web: remove locked session type guard (switch to simple boolean)
the type guard was incorrect
This commit is contained in:
@@ -128,11 +128,7 @@ type SessionTypeMap = {
|
|||||||
deleted: DeletedEditorSession;
|
deleted: DeletedEditorSession;
|
||||||
};
|
};
|
||||||
|
|
||||||
export function isLockedSession(session: EditorSession): session is
|
export function isLockedSession(session: EditorSession): boolean {
|
||||||
| LockedEditorSession
|
|
||||||
// TODO: | DefaultEditorSession
|
|
||||||
| DeletedEditorSession
|
|
||||||
| ConflictedEditorSession {
|
|
||||||
return (
|
return (
|
||||||
session.type === "locked" ||
|
session.type === "locked" ||
|
||||||
("content" in session &&
|
("content" in session &&
|
||||||
@@ -175,12 +171,16 @@ class EditorStore extends BaseStore<EditorStore> {
|
|||||||
EV.subscribe(EVENTS.vaultLocked, () => {
|
EV.subscribe(EVENTS.vaultLocked, () => {
|
||||||
this.set((state) => {
|
this.set((state) => {
|
||||||
state.sessions = state.sessions.map((session) => {
|
state.sessions = state.sessions.map((session) => {
|
||||||
console.log("REFRESHIGN", session);
|
|
||||||
if (isLockedSession(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 session;
|
||||||
|
|
||||||
return {
|
return <LockedEditorSession>{
|
||||||
type: "locked",
|
type: "locked",
|
||||||
id: session.id,
|
id: session.id,
|
||||||
note: session.note,
|
note: session.note,
|
||||||
|
|||||||
Reference in New Issue
Block a user