Skip to content

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

mobile: fix crash in list

Ammar Ahmed18b43882e160
diff --git a/apps/mobile/app/components/sheets/sort/index.tsx b/apps/mobile/app/components/sheets/sort/index.tsx
index 08200d49e..be6b2674c 100644
--- a/apps/mobile/app/components/sheets/sort/index.tsx
+++ b/apps/mobile/app/components/sheets/sort/index.tsx
@@ -67,8 +67,9 @@ const Sort = ({
? "home"
: screen === "Trash"
? "trash"
+ : screen === "Favorites"
+ ? "favorites"
: ((type + "s") as GroupingKey);
- console.log("updateGroupOptions for group", groupType, "in", screen);
await db.settings.setGroupOptions(groupType, _groupOptions);
setGroupOptions(_groupOptions);
setTimeout(() => {
diff --git a/apps/mobile/app/hooks/use-group-options.ts b/apps/mobile/app/hooks/use-group-options.ts
index e6ad2f8f2..1032bfb31 100644
--- a/apps/mobile/app/hooks/use-group-options.ts
+++ b/apps/mobile/app/hooks/use-group-options.ts
@@ -32,7 +32,7 @@ export function useGroupOptions(type: any) {
const onUpdate = (groupType: string) => {
if (groupType !== type) return;
const options = db.settings?.getGroupOptions(type) as any;
-
+ if (!options) return;
if (
groupOptions?.groupBy !== options.groupBy ||
groupOptions?.sortBy !== options.sortBy ||