From 7016d127fd56df6ab7d65a0620170074d082749b Mon Sep 17 00:00:00 2001 From: Yaddalapalli-Charan-Kumar-Naidu Date: Fri, 13 Feb 2026 21:34:48 +0530 Subject: [PATCH 1/2] fix: prevent falsy values from being coerced to null --- app/lib/methods/userPreferences.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/app/lib/methods/userPreferences.ts b/app/lib/methods/userPreferences.ts index 8e9a605ee3c..fd54ab96728 100644 --- a/app/lib/methods/userPreferences.ts +++ b/app/lib/methods/userPreferences.ts @@ -98,7 +98,8 @@ class UserPreferences { getString(key: string): string | null { try { - return this.mmkv.getString(key) || null; + const val = this.mmkv.getString(key); + return val !== undefined ? val : null; } catch { return null; } @@ -110,7 +111,8 @@ class UserPreferences { getBool(key: string): boolean | null { try { - return this.mmkv.getBoolean(key) || null; + const val = this.mmkv.getBoolean(key); + return val !== undefined ? val : null; } catch { return null; } @@ -139,7 +141,8 @@ class UserPreferences { getNumber(key: string): number | null { try { - return this.mmkv.getNumber(key) || null; + const val = this.mmkv.getNumber(key); + return val !== undefined ? val : null; } catch { return null; } From ad4c17bfe43992b78183ae493fe6901c3b48217f Mon Sep 17 00:00:00 2001 From: Yaddalapalli-Charan-Kumar-Naidu Date: Wed, 18 Feb 2026 12:35:59 +0530 Subject: [PATCH 2/2] fix: use nullish coalescing operator to simplify preference value retrieval. --- app/lib/methods/userPreferences.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/app/lib/methods/userPreferences.ts b/app/lib/methods/userPreferences.ts index fd54ab96728..2028eceb98d 100644 --- a/app/lib/methods/userPreferences.ts +++ b/app/lib/methods/userPreferences.ts @@ -98,8 +98,7 @@ class UserPreferences { getString(key: string): string | null { try { - const val = this.mmkv.getString(key); - return val !== undefined ? val : null; + return this.mmkv.getString(key) ?? null; } catch { return null; } @@ -111,8 +110,7 @@ class UserPreferences { getBool(key: string): boolean | null { try { - const val = this.mmkv.getBoolean(key); - return val !== undefined ? val : null; + return this.mmkv.getBoolean(key) ?? null; } catch { return null; } @@ -141,8 +139,7 @@ class UserPreferences { getNumber(key: string): number | null { try { - const val = this.mmkv.getNumber(key); - return val !== undefined ? val : null; + return this.mmkv.getNumber(key) ?? null; } catch { return null; }