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> { class Notifier extends Component<Props> {
displayed = [] displayed = []
shouldComponentUpdate({ notifications: newSnacks = [] }) { shouldComponentUpdate({ notifications: newSnacks = List() }) {
const { notifications: currentSnacks, closeSnackbar, removeSnackbar } = this.props const { notifications: currentSnacks, closeSnackbar, removeSnackbar } = this.props
if (!newSnacks.size) { if (!newSnacks.size) {
@ -33,7 +33,7 @@ class Notifier extends Component<Props> {
if (notExists) { if (notExists) {
continue continue
} }
notExists = notExists || !currentSnacks.filter(({ key }) => newSnack.key === key).length notExists = notExists || !currentSnacks.filter(({ key }) => newSnack.key === key).size
} }
return notExists return notExists
} }

View File

@ -1,6 +1,6 @@
// @flow // @flow
import { createAction } from 'redux-actions' 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 GlobalState } from '~/store'
import { type NotificationProps } from '~/logic/notifications/store/models/notification' import { type NotificationProps } from '~/logic/notifications/store/models/notification'
@ -10,7 +10,6 @@ const addSnackbar = createAction<string, *>(ENQUEUE_SNACKBAR)
const enqueueSnackbar = (notification: NotificationProps) => ( const enqueueSnackbar = (notification: NotificationProps) => (
dispatch: ReduxDispatch<GlobalState>, dispatch: ReduxDispatch<GlobalState>,
getState: GetState<GlobalState>,
) => { ) => {
const newNotification = { const newNotification = {
...notification, ...notification,