From eab7d380e9c31c8b958b69047e6e61ead428e6c4 Mon Sep 17 00:00:00 2001 From: ThibG Date: Wed, 9 Dec 2020 19:16:30 +0100 Subject: [PATCH] [Glitch] Fix notifications being unnecessarily redrawn on state change Port 772f525c90c14ab8557439d5d57ebe0f377e79ec to glitch-soc Co-authored-by: Claire Signed-off-by: Claire --- .../flavours/glitch/features/notifications/index.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/javascript/flavours/glitch/features/notifications/index.js b/app/javascript/flavours/glitch/features/notifications/index.js index 97434b586b..73d969517f 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') {