A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
fix: crash when searching & auto focus search input
thecodrr4ca3b3bbe0e4
diff --git a/apps/web/src/components/route-container/index.js b/apps/web/src/components/route-container/index.jsindex 9822bfdae..de87e225d 100644--- a/apps/web/src/components/route-container/index.js+++ b/apps/web/src/components/route-container/index.js@@ -69,14 +69,7 @@ function Header(props) {<Icon.Searchsize={24}onClick={() => {- navigate(- `/search`,- false,- {- type,- },- true- );+ navigate(`/search`, { type });}}/>)}diff --git a/apps/web/src/components/search/index.js b/apps/web/src/components/search/index.jsindex 295bc955b..811d368e5 100644--- a/apps/web/src/components/search/index.js+++ b/apps/web/src/components/search/index.js@@ -6,10 +6,11 @@ import Field from "../field";function SearchBox(props) {return (<Field+ autoFocusid="search"name="search"type="text"- sx={{ mx: 2 }}+ sx={{ mx: 2, mb: 2 }}placeholder="Type your query here"onKeyDown={(e) => {if (e.key === "Enter") props.onSearch(e.target.value);diff --git a/apps/web/src/views/search.js b/apps/web/src/views/search.jsindex 1fa6889bc..2a37a2f16 100644--- a/apps/web/src/views/search.js+++ b/apps/web/src/views/search.js@@ -8,9 +8,10 @@ import ProgressBar from "../components/progress-bar";import { useStore as useNoteStore } from "../stores/note-store";import { Flex, Text } from "rebass";-function typeToItems(type, context) {+async function typeToItems(type, context) {switch (type) {case "notes":+ await db.notes.init();if (!context) return ["notes", db.notes.all];const notes = notesFromContext(context);return ["notes", notes];@@ -41,8 +42,8 @@ function Search() {<><SearchBoxonSearch={async (query) => {- const [lookupType, items] = typeToItems(type, context);-+ const [lookupType, items] = await typeToItems(type, context);+ console.log(lookupType, items, type, context);setResults([]);if (items.length <= 0) return;