Skip to content

Commit

Permalink
fix: add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
khushal87 committed Sep 5, 2024
1 parent cdc3c8c commit 4ebdb59
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions package/src/components/Chat/hooks/useAppSettings.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ export const useAppSettings = <
const isMounted = useIsMountedRef();

useEffect(() => {
/**
* Fetches app settings from the backend when offline support is disabled.
*/
const enforceAppSettingsWithoutOfflineSupport = async () => {
try {
const appSettings = await client.getAppSettings();
Expand All @@ -31,6 +34,10 @@ export const useAppSettings = <
}
};

/**
* Fetches app settings from the local database when offline support is enabled if internet is off else fetches from the backend.
* Note: We need to set the app settings from the local database when offline as the client will not have the app settings in memory. For this we store it for the `client.userID`.
*/
const enforceAppSettingsWithOfflineSupport = async () => {
if (!client.userID) return;

Expand Down

0 comments on commit 4ebdb59

Please sign in to comment.