Skip to content

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

fix: search refreshes on every change in note (fixes streetwriters/notesnook#503)

thecodrr99d6e951071e
diff --git a/apps/web/src/views/search.js b/apps/web/src/views/search.js
index 84b6e5055..7aa8cc567 100644
--- a/apps/web/src/views/search.js
+++ b/apps/web/src/views/search.js
@@ -59,9 +59,6 @@ function Search({ type }) {
const results = await db.lookup[lookupType](items, query);
setResults(results);
setSearchState({ isSearching: false, totalItems: 0 });
- // if (!results.length) {
- // showToast("error", `Nothing found for "${query}".`);
- // }
},
[context, type]
);
@@ -103,8 +100,12 @@ function Search({ type }) {
}, [type, context]);
useEffect(() => {
- onSearch(cachedQuery.current);
- }, [nonce, onSearch]);
+ (async function () {
+ const [lookupType, items] = await typeToItems(type, context);
+ const results = await db.lookup[lookupType](items, cachedQuery.current);
+ setResults(results);
+ })();
+ }, [nonce, type, context]);
if (!title) return hardNavigate("/");