Skip to content

Commit

Permalink
Notification changed subscription
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenHands92 committed Apr 23, 2018
1 parent 28ead31 commit 43100e1
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
1 change: 0 additions & 1 deletion ios/SNS.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
};
objectVersion = 46;
objects = {

/* Begin PBXBuildFile section */
00C302E51ABCBA2D00DB3ED1 /* libRCTActionSheet.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302AC1ABCB8CE00DB3ED1 /* libRCTActionSheet.a */; };
00C302E71ABCBA2D00DB3ED1 /* libRCTGeolocation.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 00C302BA1ABCB90400DB3ED1 /* libRCTGeolocation.a */; };
Expand Down
9 changes: 6 additions & 3 deletions src/container/Notification/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,10 +103,13 @@ class Notification extends Component {
let newEdges;
const pageInfo = prev.notifications.pageInfo;

if (prev.notifications.edges[0]._id !== subscriptionData.data.notificationAdded._id) {
const duplicateIdx = prev.notifications.edges.findIndex(item => item._id === subscriptionData.data.notificationAdded._id);

if (duplicateIdx === -1){
newEdges = [subscriptionData.data.notificationAdded, ...prev.notifications.edges];
} else {
newEdges = prev.notifications.edges;
}
else {
newEdges = [...prev.notifications.edges.slice(0, duplicateIdx), subscriptionData.data.notificationAdded, ...prev.notifications.edges.slice(duplicateIdx + 1)];
}

return update(prev, {
Expand Down

0 comments on commit 43100e1

Please sign in to comment.