From 175cf92e748bb2fb72c4442e583157b420126043 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Thu, 22 May 2025 15:37:12 +0500 Subject: [PATCH] web: fix note not scrolling to selected match --- apps/web/src/components/editor/index.tsx | 5 ++++- apps/web/src/stores/editor-store.ts | 13 ++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/apps/web/src/components/editor/index.tsx b/apps/web/src/components/editor/index.tsx index 1f72f7920..53de9cc8b 100644 --- a/apps/web/src/components/editor/index.tsx +++ b/apps/web/src/components/editor/index.tsx @@ -239,7 +239,10 @@ const MemoizedEditorView = React.memo(EditorView, (prev, next) => { return ( prev.session.id === next.session.id && prev.session.type === next.session.type && - prev.session.needsHydration === next.session.needsHydration + prev.session.needsHydration === next.session.needsHydration && + prev.session.activeBlockId === next.session.activeBlockId && + prev.session.activeSearchResultIndex === + next.session.activeSearchResultIndex ); }); function EditorView({ diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts index 248e24ac8..d7f563a8d 100644 --- a/apps/web/src/stores/editor-store.ts +++ b/apps/web/src/stores/editor-store.ts @@ -719,13 +719,12 @@ class EditorStore extends BaseStore { const oldSessionOfNote = sessions.find( (s) => "note" in s && s.note.id === noteId && s.tabId === tabId ); - const sessionId = options.force - ? tabSessionHistory.add(tabId) - : activeSession?.needsHydration || - activeSession?.type === "new" || - noteAlreadyOpened - ? activeSession.id - : tabSessionHistory.add(tabId, oldSessionOfNote?.id); + const sessionId = + activeSession?.needsHydration || + activeSession?.type === "new" || + noteAlreadyOpened + ? activeSession.id + : tabSessionHistory.add(tabId, oldSessionOfNote?.id); const isLocked = await db.vaults.itemExists(note); if (note.conflicted) {