Skip to content

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

web: fix note not scrolling to selected match

Abdullah Attac861b11c5ff4
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<EditorStore> {
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) {