From 4aa48d8fce913b3a84b4272530de2bca8b42d8b6 Mon Sep 17 00:00:00 2001 From: Mikhail Mikheev Date: Thu, 10 Oct 2019 18:33:39 +0400 Subject: [PATCH] More notification fixes --- src/components/Notifier/index.js | 6 +++--- src/logic/notifications/store/actions/enqueueSnackbar.js | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/components/Notifier/index.js b/src/components/Notifier/index.js index 009afe0a..6ad573b5 100644 --- a/src/components/Notifier/index.js +++ b/src/components/Notifier/index.js @@ -4,7 +4,7 @@ import { List } from 'immutable' import { connect } from 'react-redux' import { withSnackbar } from 'notistack' import { type Notification } from '~/logic/notifications/store/models/notification' -import actions, {type Actions } from './actions' +import actions, { type Actions } from './actions' import selector from './selector' type Props = Actions & { @@ -14,7 +14,7 @@ type Props = Actions & { class Notifier extends Component { displayed = [] - shouldComponentUpdate({ notifications: newSnacks = [] }) { + shouldComponentUpdate({ notifications: newSnacks = List() }) { const { notifications: currentSnacks, closeSnackbar, removeSnackbar } = this.props if (!newSnacks.size) { @@ -33,7 +33,7 @@ class Notifier extends Component { if (notExists) { continue } - notExists = notExists || !currentSnacks.filter(({ key }) => newSnack.key === key).length + notExists = notExists || !currentSnacks.filter(({ key }) => newSnack.key === key).size } return notExists } diff --git a/src/logic/notifications/store/actions/enqueueSnackbar.js b/src/logic/notifications/store/actions/enqueueSnackbar.js index e14abe0c..fb88da5c 100644 --- a/src/logic/notifications/store/actions/enqueueSnackbar.js +++ b/src/logic/notifications/store/actions/enqueueSnackbar.js @@ -1,6 +1,6 @@ // @flow import { createAction } from 'redux-actions' -import type { Dispatch as ReduxDispatch, GetState } from 'redux' +import type { Dispatch as ReduxDispatch } from 'redux' import { type GlobalState } from '~/store' import { type NotificationProps } from '~/logic/notifications/store/models/notification' @@ -10,7 +10,6 @@ const addSnackbar = createAction(ENQUEUE_SNACKBAR) const enqueueSnackbar = (notification: NotificationProps) => ( dispatch: ReduxDispatch, - getState: GetState, ) => { const newNotification = { ...notification,