Use integer type of notitication ids (avoid redundant casting for getting maxId in addNewNotifications)

This commit is contained in:
eugenijm 2019-02-02 18:39:54 +03:00
parent 0ab2f17991
commit b62d2c76e5
2 changed files with 3 additions and 4 deletions

View file

@ -273,11 +273,10 @@ const addNewNotifications = (state, { dispatch, notifications, older, visibleNot
// Only add a new notification if we don't have one for the same action // Only add a new notification if we don't have one for the same action
if (!state.notifications.idStore.hasOwnProperty(notification.id)) { if (!state.notifications.idStore.hasOwnProperty(notification.id)) {
const notificationId = parseInt(notification.id, 10) state.notifications.maxId = notification.id > state.notifications.maxId
state.notifications.maxId = notificationId > parseInt(state.notifications.maxId, 10)
? notification.id ? notification.id
: state.notifications.maxId : state.notifications.maxId
state.notifications.minId = notificationId < parseInt(state.notifications.minId, 10) state.notifications.minId = notification.id < state.notifications.minId
? notification.id ? notification.id
: state.notifications.minId : state.notifications.minId

View file

@ -268,7 +268,7 @@ export const parseNotification = (data) => {
} }
output.created_at = new Date(data.created_at) output.created_at = new Date(data.created_at)
output.id = String(data.id) output.id = data.id
return output return output
} }