gearheads
/
mastodon
Archived
2
0
Fork 0

Fix notifications being unnecessarily redrawn on state change (#15312)

Co-authored-by: Claire <claire.github-309c@sitedethib.com>
gh/stable
ThibG 2020-12-09 19:16:30 +01:00 committed by GitHub
parent 127c543a6e
commit 9669167aae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 1 deletions

View File

@ -32,10 +32,16 @@ const messages = defineMessages({
markAsRead : { id: 'notifications.mark_as_read', defaultMessage: 'Mark every notification as read' }, 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([ const getNotifications = createSelector([
state => state.getIn(['settings', 'notifications', 'quickFilter', 'show']), state => state.getIn(['settings', 'notifications', 'quickFilter', 'show']),
state => state.getIn(['settings', 'notifications', 'quickFilter', 'active']), state => state.getIn(['settings', 'notifications', 'quickFilter', 'active']),
state => ImmutableList(state.getIn(['settings', 'notifications', 'shows']).filter(item => !item).keys()), getExcludedTypes,
state => state.getIn(['notifications', 'items']), state => state.getIn(['notifications', 'items']),
], (showFilterBar, allowedType, excludedTypes, notifications) => { ], (showFilterBar, allowedType, excludedTypes, notifications) => {
if (!showFilterBar || allowedType === 'all') { if (!showFilterBar || allowedType === 'all') {