|
@@ -23,7 +23,7 @@ const InAppNotificationDropdown: FC<Props> = (props: Props) => {
|
|
|
const [count, setCount] = useState(0);
|
|
const [count, setCount] = useState(0);
|
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
const [isOpen, setIsOpen] = useState(false);
|
|
|
const limit = 6;
|
|
const limit = 6;
|
|
|
- const { data: inAppNotificationData } = useSWRxInAppNotifications(limit);
|
|
|
|
|
|
|
+ const { data: inAppNotificationData, mutate } = useSWRxInAppNotifications(limit);
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
useEffect(() => {
|
|
|
initializeSocket(props);
|
|
initializeSocket(props);
|
|
@@ -59,11 +59,14 @@ const InAppNotificationDropdown: FC<Props> = (props: Props) => {
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
const toggleDropdownHandler = () => {
|
|
const toggleDropdownHandler = () => {
|
|
|
- if (isOpen === false && count > 0) {
|
|
|
|
|
|
|
+ if (!isOpen && count > 0) {
|
|
|
updateNotificationStatus();
|
|
updateNotificationStatus();
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
const newIsOpenState = !isOpen;
|
|
const newIsOpenState = !isOpen;
|
|
|
|
|
+ if (newIsOpenState) {
|
|
|
|
|
+ mutate();
|
|
|
|
|
+ }
|
|
|
setIsOpen(newIsOpenState);
|
|
setIsOpen(newIsOpenState);
|
|
|
};
|
|
};
|
|
|
|
|
|