Skip to content

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

mobile: fix event subscription

Ammar Ahmedbf536eb18311
diff --git a/apps/mobile/app/hooks/use-app-events.tsx b/apps/mobile/app/hooks/use-app-events.tsx
index 79abc6a63..84bbd2e22 100644
--- a/apps/mobile/app/hooks/use-app-events.tsx
+++ b/apps/mobile/app/hooks/use-app-events.tsx
@@ -840,7 +840,13 @@ export const useAppEvents = () => {
return () => {
emitterSubscriptions.forEach((sub) => sub?.remove?.());
- subscriptions.forEach((sub) => sub?.unsubscribe?.());
+ subscriptions.forEach((sub) => {
+ if (Array.isArray(sub)) {
+ sub.forEach((s) => s.unsubscribe());
+ } else {
+ sub?.unsubscribe?.();
+ }
+ });
};
}, [onSyncComplete, onUserUpdated]);