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 <afsuyadi@gmail.com>

* core: guard notesWithHighlighting against an undefined notes selector.
Signed-off-by: Suyadi <afsuyadi@gmail.com>

* core: add regression test for notesWithHighlighting crash.
Signed-off-by: Suyadi <afsuyadi@gmail.com>

* core: revert changes after feedback
Signed-off-by: Suyadi <afsuyadi@gmail.com>

* mobile: ensure type: "note" will make items become mandatory.
Signed-off-by: Suyadi <afsuyadi@gmail.com>

* core: remove tests after feedback
Signed-off-by: Suyadi <afsuyadi@gmail.com>
This commit is contained in:
Suyadi
2026-07-31 01:01:21 +07:00
committed by GitHub
parent 4765657423
commit a1879dae17
3 changed files with 18 additions and 9 deletions

View File

@@ -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}

View File

@@ -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<Item>;
};
Search:
| {
placeholder: string;
type: "note";
title: string;
route: RouteName;
items: FilteredSelector<Note>;
}
| {
placeholder: string;
type: Exclude<ItemType, "note">;
title: string;
route: RouteName;
items?: FilteredSelector<Item>;
};
TaggedNotes: NotesScreenParams;
ColoredNotes: NotesScreenParams;
TopicNotes: NotesScreenParams;