More notification fixes
This commit is contained in:
parent
de16a0cdec
commit
4aa48d8fce
|
@ -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<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
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
Loading…
Reference in New Issue