diff --git a/package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx b/package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx index c83111b9f0..3f96bdab75 100644 --- a/package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx +++ b/package/src/components/Chat/hooks/__tests__/useAppSettings.test.tsx @@ -18,6 +18,7 @@ describe('useAppSettings', () => { auto_translation_enabled: true, }), ), + userID: 'some-user-id', } as unknown as StreamChat, isOnline, false, diff --git a/package/src/components/Chat/hooks/useAppSettings.ts b/package/src/components/Chat/hooks/useAppSettings.ts index b3e77552db..f424f8d18e 100644 --- a/package/src/components/Chat/hooks/useAppSettings.ts +++ b/package/src/components/Chat/hooks/useAppSettings.ts @@ -22,6 +22,8 @@ export const useAppSettings = < * Fetches app settings from the backend when offline support is disabled. */ const enforceAppSettingsWithoutOfflineSupport = async () => { + if (!client.userID) return; + try { const appSettings = await client.getAppSettings(); if (isMounted.current) {