More notification fixes

This commit is contained in:
Mikhail Mikheev 2019-10-10 18:33:39 +04:00
parent de16a0cdec
commit 4aa48d8fce
2 changed files with 4 additions and 5 deletions

View File

@ -14,7 +14,7 @@ type Props = Actions & {
class Notifier extends Component<Props> {
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<Props> {
if (notExists) {
continue
}
notExists = notExists || !currentSnacks.filter(({ key }) => newSnack.key === key).length
notExists = notExists || !currentSnacks.filter(({ key }) => newSnack.key === key).size
}
return notExists
}

View File

@ -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<string, *>(ENQUEUE_SNACKBAR)
const enqueueSnackbar = (notification: NotificationProps) => (
dispatch: ReduxDispatch<GlobalState>,
getState: GetState<GlobalState>,
) => {
const newNotification = {
...notification,