From: ThibG Date: Wed, 9 Dec 2020 18:16:30 +0000 (+0100) Subject: Fix notifications being unnecessarily redrawn on state change (#15312) X-Git-Url: https://git.xn--scling-oua.cat.family/?a=commitdiff_plain;h=9669167aaeaa834dcc99fa7df961c4f9b8118850;p=mastodon.git Fix notifications being unnecessarily redrawn on state change (#15312) Co-authored-by: Claire --- diff --git a/app/javascript/mastodon/features/notifications/index.js b/app/javascript/mastodon/features/notifications/index.js index 73df7f49d..2e0afd863 100644 --- a/app/javascript/mastodon/features/notifications/index.js +++ b/app/javascript/mastodon/features/notifications/index.js @@ -32,10 +32,16 @@ const messages = defineMessages({ markAsRead : { id: 'notifications.mark_as_read', defaultMessage: 'Mark every notification as read' }, }); +const getExcludedTypes = createSelector([ + state => state.getIn(['settings', 'notifications', 'shows']), +], (shows) => { + return ImmutableList(shows.filter(item => !item).keys()); +}); + const getNotifications = createSelector([ state => state.getIn(['settings', 'notifications', 'quickFilter', 'show']), state => state.getIn(['settings', 'notifications', 'quickFilter', 'active']), - state => ImmutableList(state.getIn(['settings', 'notifications', 'shows']).filter(item => !item).keys()), + getExcludedTypes, state => state.getIn(['notifications', 'items']), ], (showFilterBar, allowedType, excludedTypes, notifications) => { if (!showFilterBar || allowedType === 'all') {