]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Fix notifications being unnecessarily redrawn on state change
authorThibG <thib@sitedethib.com>
Wed, 9 Dec 2020 18:16:30 +0000 (19:16 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Thu, 10 Dec 2020 08:42:32 +0000 (09:42 +0100)
Port 9669167aaeaa834dcc99fa7df961c4f9b8118850 to glitch-soc

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
app/javascript/flavours/glitch/features/notifications/index.js

index 97434b586b8b49b76fc1ccfdc20f5a8a00d2d9ba..73d969517f9869d02749846000e6678957a749ba 100644 (file)
@@ -37,10 +37,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') {