Skip to content

Commit

Permalink
fix: refactor useref code
Browse files Browse the repository at this point in the history
  • Loading branch information
sundasnoreen12 committed Oct 21, 2024
1 parent 05ce6b2 commit f7f51e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 0 additions & 4 deletions src/learning-header/New-AuthenticatedUserDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -59,10 +59,6 @@ const NewAuthenticatedUserDropdown = (props) => {
careersMenuItem = '';
}

// if (!isNewNotificationView) {
// return null;
// }

return (
<Dropdown className="user-dropdown ml-3">
<Dropdown.Toggle variant="outline-primary" id="user-dropdown">
Expand Down
6 changes: 4 additions & 2 deletions src/new-notifications/NotificationTabs.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ const NotificationTabs = () => {
const {
appName, handleActiveTab, tabsCount, appsId, updateNotificationData,
} = useContext(notificationsContext);
const fetchNotificationsRef = useRef(null);
const { fetchNotificationList, markNotificationsAsSeen } = useNotification();

const fetchNotificationsList = useCallback(async () => {
Expand All @@ -25,8 +26,9 @@ const NotificationTabs = () => {
}
}, [appName, fetchNotificationList, updateNotificationData, markNotificationsAsSeen, tabsCount]);

const fetchNotificationsRef = useRef(fetchNotificationsList);
fetchNotificationsRef.current = fetchNotificationsList;
useEffect(() => {
fetchNotificationsRef.current = fetchNotificationsList;
}, [fetchNotificationsList]);

useEffect(() => {
const fetchNotifications = async () => {
Expand Down

0 comments on commit f7f51e4

Please sign in to comment.