about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/notifications/index.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-12-09 19:16:30 +0100
committerClaire <claire.github-309c@sitedethib.com>2020-12-10 09:42:32 +0100
commit237025b5efdd8294efb0e5e63bf6cabd84344553 (patch)
tree5ab2b77da61ca8e8b8076d76fe89ac668d3ed828 /app/javascript/flavours/glitch/features/notifications/index.js
parent7782e4dc0d9db4835c0f57232da9f8676c97d562 (diff)
[Glitch] Fix notifications being unnecessarily redrawn on state change
Port 9669167aaeaa834dcc99fa7df961c4f9b8118850 to glitch-soc

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
Signed-off-by: Claire <claire.github-309c@sitedethib.com>
Diffstat (limited to 'app/javascript/flavours/glitch/features/notifications/index.js')
-rw-r--r--app/javascript/flavours/glitch/features/notifications/index.js8
1 files changed, 7 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/notifications/index.js b/app/javascript/flavours/glitch/features/notifications/index.js
index 97434b586..73d969517 100644
--- a/app/javascript/flavours/glitch/features/notifications/index.js
+++ b/app/javascript/flavours/glitch/features/notifications/index.js
@@ -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') {