From c796225f2f842f656ff8bfa4b039a2257124ec97 Mon Sep 17 00:00:00 2001 From: Anthony T <76715818+anthonyss09@users.noreply.github.com> Date: Mon, 12 Sep 2022 22:51:35 -0400 Subject: [PATCH] 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 allNotificationsRead is being called in useLayoutEffect and notifications.filter(n=>!n.read) is 0. So we should filter based upon isNew. --- docs/tutorials/essentials/part-6-performance-normalization.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/tutorials/essentials/part-6-performance-normalization.md b/docs/tutorials/essentials/part-6-performance-normalization.md index e853534ba9..4569777691 100644 --- a/docs/tutorials/essentials/part-6-performance-normalization.md +++ b/docs/tutorials/essentials/part-6-performance-normalization.md @@ -477,7 +477,7 @@ export const Navbar = () => { const dispatch = useDispatch() // highlight-start const notifications = useSelector(selectAllNotifications) - const numUnreadNotifications = notifications.filter(n => !n.read).length + const numUnreadNotifications = notifications.filter(n => n.isNew).length // highlight-end // omit component contents // highlight-start