Skip to content

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

fix error in settings when logged out

ammarahm-ed3ad177a845eb
diff --git a/apps/mobile/src/screens/settings/home.tsx b/apps/mobile/src/screens/settings/home.tsx
index 97be1488d..7ccc8af7a 100644
--- a/apps/mobile/src/screens/settings/home.tsx
+++ b/apps/mobile/src/screens/settings/home.tsx
@@ -69,6 +69,7 @@ const groups: SettingSection[] = [
sections: [
{
useHook: () => useUserStore(state => state.user),
+ hidden: current => !current,
name: current => {
const user = current;
const isBasic = user.subscription?.type === SUBSCRIPTION_STATUS.BASIC;
diff --git a/apps/mobile/src/screens/settings/usersection.js b/apps/mobile/src/screens/settings/usersection.js
index 6499ddfad..22d709592 100644
--- a/apps/mobile/src/screens/settings/usersection.js
+++ b/apps/mobile/src/screens/settings/usersection.js
@@ -38,12 +38,12 @@ const SettingsUserSection = ({ item }) => {
const expiryDate = dayjs(user?.subscription?.expiry).format('MMMM D, YYYY');
const startDate = dayjs(user?.subscription?.start).format('MMMM D, YYYY');
const monthlyPlan = usePricing('monthly');
- const isBasic = user.subscription?.type === SUBSCRIPTION_STATUS.BASIC;
- const isTrial = user.subscription?.type === SUBSCRIPTION_STATUS.TRIAL;
- const isPro = user.subscription?.type === SUBSCRIPTION_STATUS.PREMIUM;
+ const isBasic = user?.subscription?.type === SUBSCRIPTION_STATUS.BASIC;
+ const isTrial = user?.subscription?.type === SUBSCRIPTION_STATUS.TRIAL;
+ const isPro = user?.subscription?.type === SUBSCRIPTION_STATUS.PREMIUM;
const isNotPro =
- user.subscription?.type !== SUBSCRIPTION_STATUS.PREMIUM &&
- user.subscription?.type !== SUBSCRIPTION_STATUS.BETA;
+ user?.subscription?.type !== SUBSCRIPTION_STATUS.PREMIUM &&
+ user?.subscription?.type !== SUBSCRIPTION_STATUS.BETA;
const lastSynced = useUserStore(state => state.lastSynced);