From ac0b9508de9756ebecd9be8750d2ff4c6c7ac45f Mon Sep 17 00:00:00 2001 From: Szymon Lesisz Date: Wed, 3 Oct 2018 14:39:23 +0200 Subject: [PATCH] fix for NotificationGroup missing key real notifications (from reducer) doesn't have "key" field so it needs to be created dynamically --- .../components/NotificationsGroups/components/Group/index.js | 2 +- .../components/Action/components/NotificationsGroups/index.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/components/notifications/Context/components/Action/components/NotificationsGroups/components/Group/index.js b/src/components/notifications/Context/components/Action/components/NotificationsGroups/components/Group/index.js index 3edec964..b8073cf4 100644 --- a/src/components/notifications/Context/components/Action/components/NotificationsGroups/components/Group/index.js +++ b/src/components/notifications/Context/components/Action/components/NotificationsGroups/components/Group/index.js @@ -108,7 +108,7 @@ Group.propTypes = { close: PropTypes.func.isRequired, groupNotifications: PropTypes.arrayOf( PropTypes.shape({ - key: PropTypes.number, + key: PropTypes.object, type: PropTypes.string, title: PropTypes.string, message: PropTypes.string, diff --git a/src/components/notifications/Context/components/Action/components/NotificationsGroups/index.js b/src/components/notifications/Context/components/Action/components/NotificationsGroups/index.js index db61988c..db936f1c 100644 --- a/src/components/notifications/Context/components/Action/components/NotificationsGroups/index.js +++ b/src/components/notifications/Context/components/Action/components/NotificationsGroups/index.js @@ -2,7 +2,6 @@ import React, { Component } from 'react'; import styled from 'styled-components'; import PropTypes from 'prop-types'; -import { PRIORITY } from 'constants/notifications'; import Group from './components/Group'; const Wrapper = styled.div``; @@ -14,7 +13,7 @@ class NotificationsGroup extends Component { if (!acc[key]) { acc[key] = []; } - acc[key].push(obj); + acc[key].push({ ...obj, key: obj }); return acc; }, {});