Skip to content

Commit

Permalink
refactor: Improve logic for setting up notifications
Browse files Browse the repository at this point in the history
  • Loading branch information
tjtanjin committed Feb 25, 2025
1 parent 9a47835 commit 18b3526
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/hooks/internal/useBotEffectsInternal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,8 @@ export const useBotEffectsInternal = () => {
};
}, []);

// default setup for notifications, text area, chat window, audio and voice
// default setup for text area, chat window, audio and voice
useEffect(() => {
setUpNotifications();
setTextAreaDisabled(settings.chatInput?.disabled as boolean);
setIsChatWindowOpen(settings.chatWindow?.defaultOpen as boolean);
setAudioToggledOn(settings.audio?.defaultToggledOn as boolean);
Expand All @@ -117,6 +116,14 @@ export const useBotEffectsInternal = () => {
}, 1)
}, [])

// default setup for notifications
useEffect(() => {
if (settings.notification?.disabled) {
return;
}
setUpNotifications();
}, [settings.notification?.disabled])

// scrolls to bottom if bot is typing and user is not scrolling
useEffect(() => {
if (!isScrolling && chatBodyRef?.current) {
Expand Down

0 comments on commit 18b3526

Please sign in to comment.