]> cat aescling's git repositories - mastodon.git/commitdiff
Fix notifications being unnecessarily redrawn on state change (#15312)
authorThibG <thib@sitedethib.com>
Wed, 9 Dec 2020 18:16:30 +0000 (19:16 +0100)
committerGitHub <noreply@github.com>
Wed, 9 Dec 2020 18:16:30 +0000 (19:16 +0100)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/mastodon/features/notifications/index.js

index 73df7f49d0f8db1db05eda8fdb73eb1500f37c0b..2e0afd8634fa9d2daafa931af57bbd414cbc6348 100644 (file)
@@ -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') {