Skip to content

Commit ade239b

Browse files
committed
ENG-1478: guard getGlobalSetting/getPersonalSetting against empty keys
1 parent ee8bf56 commit ade239b

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

apps/roam/src/components/settings/utils/accessors.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -724,6 +724,8 @@ export const getGlobalSettings = (): GlobalSettings => {
724724
export const getGlobalSetting = <T = unknown>(
725725
keys: string[],
726726
): T | undefined => {
727+
if (keys.length === 0) return undefined;
728+
727729
if (!isNewSettingsStoreEnabled()) {
728730
return getLegacyGlobalSetting(keys) as T | undefined;
729731
}
@@ -788,6 +790,8 @@ export const getPersonalSettings = (): PersonalSettings => {
788790
export const getPersonalSetting = <T = unknown>(
789791
keys: string[],
790792
): T | undefined => {
793+
if (keys.length === 0) return undefined;
794+
791795
if (!isNewSettingsStoreEnabled()) {
792796
return getLegacyPersonalSetting(keys) as T | undefined;
793797
}

0 commit comments

Comments
 (0)