Skip to content

Commit 2e950e6

Browse files
fix: refactor useref code
1 parent 0fbca00 commit 2e950e6

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

src/learning-header/New-AuthenticatedUserDropdown.jsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,10 +59,6 @@ const NewAuthenticatedUserDropdown = (props) => {
5959
careersMenuItem = '';
6060
}
6161

62-
// if (!isNewNotificationView) {
63-
// return null;
64-
// }
65-
6662
return (
6763
<Dropdown className="user-dropdown ml-3">
6864
<Dropdown.Toggle variant="outline-primary" id="user-dropdown">

src/new-notifications/NotificationTabs.jsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ const NotificationTabs = () => {
1414
const {
1515
appName, handleActiveTab, tabsCount, appsId, updateNotificationData,
1616
} = useContext(notificationsContext);
17+
const fetchNotificationsRef = useRef(null);
1718
const { fetchNotificationList, markNotificationsAsSeen } = useNotification();
1819

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

28-
const fetchNotificationsRef = useRef(fetchNotificationsList);
29-
fetchNotificationsRef.current = fetchNotificationsList;
29+
useEffect(() => {
30+
fetchNotificationsRef.current = fetchNotificationsList;
31+
}, [fetchNotificationsList]);
3032

3133
useEffect(() => {
3234
const fetchNotifications = async () => {

0 commit comments

Comments
 (0)