From 9fb8d29a34eeea1046209707aff09bc567830660 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Mon, 25 May 2026 12:51:21 +0500 Subject: [PATCH] web: fix editor readonly state not updating in realtime --- apps/web/src/stores/editor-store.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts index 50344d2e2..fbd7390d4 100644 --- a/apps/web/src/stores/editor-store.ts +++ b/apps/web/src/stores/editor-store.ts @@ -286,7 +286,8 @@ class EditorStore extends BaseStore { const clearIds: string[] = []; for (const session of sessions) { if (session.type === "new") continue; - if (session.note.id !== item.id && session.note.contentId !== item.id) continue; + if (session.note.id !== item.id && session.note.contentId !== item.id) + continue; if (isDeleted(item) || isTrashItem(item)) clearIds.push(session.tabId); // if a note becomes conflicted, reopen the session @@ -331,6 +332,13 @@ class EditorStore extends BaseStore { !item.readonly ) openSession(session.note.id, { force: true, silent: true }); + // if a note is made readonly, reopen the session + else if ( + session.type !== "readonly" && + item.type === "note" && + item.readonly + ) + openSession(session.note.id, { force: true, silent: true }); // update the note in all sessions else if (item.type === "note") { updateSession(