From 47862c3182193010dae375de413e87ccfd1bc3dc Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Thu, 14 Mar 2024 13:00:04 +0500 Subject: [PATCH] web: fix lock/unlock from properties not working --- apps/web/src/components/properties/index.tsx | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/apps/web/src/components/properties/index.tsx b/apps/web/src/components/properties/index.tsx index 98cb71e45..477f52e8a 100644 --- a/apps/web/src/components/properties/index.tsx +++ b/apps/web/src/components/properties/index.tsx @@ -114,7 +114,6 @@ function EditorProperties(props: EditorPropertiesProps) { const session = useEditorStore((store) => store.getSession(props.session.id, [props.session.type]) ); - console.log(session); if (isFocusMode || !session) return null; return ( changeToggleState(tool.key, session)} testId={`properties-${tool.key}`} /> @@ -720,18 +723,13 @@ function changeToggleState( prop: "lock" | "readonly" | "local-only" | "pin" | "favorite", session: ReadonlyEditorSession | DefaultEditorSession ) { - const { - id: sessionId, - locked, - readonly, - localOnly, - pinned, - favorite - } = session.note; + const { id: sessionId, readonly, localOnly, pinned, favorite } = session.note; if (!sessionId) return; switch (prop) { case "lock": - return locked ? noteStore.unlock(sessionId) : noteStore.lock(sessionId); + return "locked" in session && session.locked + ? noteStore.unlock(sessionId) + : noteStore.lock(sessionId); case "readonly": return noteStore.readonly(!readonly, sessionId); case "local-only":