@@ -9,6 +9,7 @@ export const useAppSettings = <
99> (
1010 client : StreamChat < StreamChatGenerics > ,
1111 isOnline : boolean | null ,
12+ enableOfflineSupport : boolean ,
1213) : AppSettingsAPIResponse | null => {
1314 const [ appSettings , setAppSettings ] = useState < AppSettingsAPIResponse | null > ( null ) ;
1415 const isMounted = useRef ( true ) ;
@@ -17,7 +18,7 @@ export const useAppSettings = <
1718 async function enforeAppSettings ( ) {
1819 if ( ! client . userID ) return ;
1920
20- if ( ! isOnline ) {
21+ if ( ! isOnline && enableOfflineSupport ) {
2122 const appSettings = dbApi . getAppSettings ( { currentUserId : client . userID } ) ;
2223 setAppSettings ( appSettings ) ;
2324 return ;
@@ -27,10 +28,11 @@ export const useAppSettings = <
2728 const appSettings = await client . getAppSettings ( ) ;
2829 if ( isMounted . current ) {
2930 setAppSettings ( appSettings ) ;
30- dbApi . upsertAppSettings ( {
31- appSettings,
32- currentUserId : client . userID as string ,
33- } ) ;
31+ enableOfflineSupport &&
32+ dbApi . upsertAppSettings ( {
33+ appSettings,
34+ currentUserId : client . userID as string ,
35+ } ) ;
3436 }
3537 } catch ( error : unknown ) {
3638 if ( error instanceof Error ) {
0 commit comments