about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/notifications/index.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-12-09 19:16:30 +0100
committerGitHub <noreply@github.com>2020-12-09 19:16:30 +0100
commit9669167aaeaa834dcc99fa7df961c4f9b8118850 (patch)
treea981ee1e72d7703842ced02d6a70df73b27abe1b /app/javascript/mastodon/features/notifications/index.js
parent127c543a6e59d20de68e6760e952d18ed53578e9 (diff)
Fix notifications being unnecessarily redrawn on state change (#15312)
Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/mastodon/features/notifications/index.js')
-rw-r--r--app/javascript/mastodon/features/notifications/index.js8
1 files changed, 7 insertions, 1 deletions
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') {