Skip to content

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

web: fix note not opening from search results if its already opened

Abdullah Atta4f540dfdcb12
diff --git a/apps/web/src/components/search-result/index.tsx b/apps/web/src/components/search-result/index.tsx
index 1e98e6631..322bddeb6 100644
--- a/apps/web/src/components/search-result/index.tsx
+++ b/apps/web/src/components/search-result/index.tsx
@@ -52,7 +52,7 @@ function SearchResult(props: SearchResultProps) {
return (
<ListItem
- isFocused={isOpened}
+ isFocused={match ? false : isOpened}
isCompact={!match}
item={item}
menuItems={noteMenuItems}
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.ts
index d7f563a8d..248e24ac8 100644
--- a/apps/web/src/stores/editor-store.ts
+++ b/apps/web/src/stores/editor-store.ts
@@ -719,12 +719,13 @@ class EditorStore extends BaseStore<EditorStore> {
const oldSessionOfNote = sessions.find(
(s) => "note" in s && s.note.id === noteId && s.tabId === tabId
);
- const sessionId =
- activeSession?.needsHydration ||
- activeSession?.type === "new" ||
- noteAlreadyOpened
- ? activeSession.id
- : tabSessionHistory.add(tabId, oldSessionOfNote?.id);
+ const sessionId = options.force
+ ? tabSessionHistory.add(tabId)
+ : activeSession?.needsHydration ||
+ activeSession?.type === "new" ||
+ noteAlreadyOpened
+ ? activeSession.id
+ : tabSessionHistory.add(tabId, oldSessionOfNote?.id);
const isLocked = await db.vaults.itemExists(note);
if (note.conflicted) {