From a1879dae1751227953812ac9801668a0ec2d741d Mon Sep 17 00:00:00 2001 From: Suyadi <104284194+afsuyadi@users.noreply.github.com> Date: Fri, 31 Jul 2026 01:01:21 +0700 Subject: [PATCH] mobile: fix error on android's search query (#10106) * mobile: pass value for items when searching on main screen to match other screens' pattern Signed-off-by: Suyadi * core: guard notesWithHighlighting against an undefined notes selector. Signed-off-by: Suyadi * core: add regression test for notesWithHighlighting crash. Signed-off-by: Suyadi * core: revert changes after feedback Signed-off-by: Suyadi * mobile: ensure type: "note" will make items become mandatory. Signed-off-by: Suyadi * core: remove tests after feedback Signed-off-by: Suyadi --- apps/mobile/app/screens/home/index.tsx | 4 +++- .../mobile/app/stores/use-navigation-store.ts | 22 +++++++++++++------ packages/core/src/api/lookup.ts | 1 - 3 files changed, 18 insertions(+), 9 deletions(-) diff --git a/apps/mobile/app/screens/home/index.tsx b/apps/mobile/app/screens/home/index.tsx index 46c4fa111..bdb556c49 100755 --- a/apps/mobile/app/screens/home/index.tsx +++ b/apps/mobile/app/screens/home/index.tsx @@ -30,6 +30,7 @@ import SettingsService from "../../services/settings"; import useNavigationStore from "../../stores/use-navigation-store"; import { useNotes } from "../../stores/use-notes-store"; import { openEditor } from "../notes/common"; +import { db } from "../../common/database"; export const Home = ({ navigation, route }: NavigationProps<"Notes">) => { const [notes, loading] = useNotes(); @@ -59,7 +60,8 @@ export const Home = ({ navigation, route }: NavigationProps<"Notes">) => { placeholder: strings.searchInRoute(route.name), type: "note", title: route.name, - route: route.name + route: route.name, + items: db.notes.all }); }} id={route.name} diff --git a/apps/mobile/app/stores/use-navigation-store.ts b/apps/mobile/app/stores/use-navigation-store.ts index e3b1ff5c6..2d98a26ff 100644 --- a/apps/mobile/app/stores/use-navigation-store.ts +++ b/apps/mobile/app/stores/use-navigation-store.ts @@ -74,13 +74,21 @@ export interface RouteParams extends ParamListBase { Tags: GenericRouteParam; Favorites: GenericRouteParam; Trash: GenericRouteParam; - Search: { - placeholder: string; - type: ItemType; - title: string; - route: RouteName; - items?: FilteredSelector; - }; + Search: + | { + placeholder: string; + type: "note"; + title: string; + route: RouteName; + items: FilteredSelector; + } + | { + placeholder: string; + type: Exclude; + title: string; + route: RouteName; + items?: FilteredSelector; + }; TaggedNotes: NotesScreenParams; ColoredNotes: NotesScreenParams; TopicNotes: NotesScreenParams; diff --git a/packages/core/src/api/lookup.ts b/packages/core/src/api/lookup.ts index d1ae43f00..2096d10b8 100644 --- a/packages/core/src/api/lookup.ts +++ b/packages/core/src/api/lookup.ts @@ -114,7 +114,6 @@ export default class Lookup { ): Promise> { const db = this.db.sql() as unknown as Kysely; const excludedIds = this.db.trash.cache.notes; - const { content, title,