Skip to content

Commit c796225

Browse files
authored
Update part-6-performance-normalization.md
line 480 when the original filter returned notifications where !notification.read was the condition, due to the second render of <NotificationList/> allNotificationsRead is being called in useLayoutEffect and notifications.filter(n=>!n.read) is 0. So we should filter based upon isNew.
1 parent 75460c2 commit c796225

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

docs/tutorials/essentials/part-6-performance-normalization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -477,7 +477,7 @@ export const Navbar = () => {
477477
const dispatch = useDispatch()
478478
// highlight-start
479479
const notifications = useSelector(selectAllNotifications)
480-
const numUnreadNotifications = notifications.filter(n => !n.read).length
480+
const numUnreadNotifications = notifications.filter(n => n.isNew).length
481481
// highlight-end
482482
// omit component contents
483483
// highlight-start

0 commit comments

Comments
 (0)