From ee408b953941f46e9e150e74bf8ddaf2201d823c Mon Sep 17 00:00:00 2001 From: barteksekula Date: Sun, 14 Apr 2019 19:12:13 +0200 Subject: [PATCH 1/2] fix saving new locations we need to assign the id we got from server back to the review location instance --- src/ui/reviewStore.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/ui/reviewStore.tsx b/src/ui/reviewStore.tsx index a13dfa26..48a12efb 100644 --- a/src/ui/reviewStore.tsx +++ b/src/ui/reviewStore.tsx @@ -262,7 +262,7 @@ class ReviewComponentStore implements IReviewComponentStore { positionX: reviewLocation.positionX, positionY: reviewLocation.positionY, priority: reviewLocation.priority, - comments: reviewLocation.comments.map((x: any) => { + comments: reviewLocation.comments.map((x: any) => { return { author: x.author, date: x.date, @@ -278,6 +278,7 @@ class ReviewComponentStore implements IReviewComponentStore { }; this._advancedReviewService.add(reviewLocation.id, data).then((result) => { if (reviewLocation.id !== result.id) { + reviewLocation.id = result.id; this.reviewLocations.push(reviewLocation); } resolve(reviewLocation); From 8e0e08537e920ff0e663f846cbb32720db984742 Mon Sep 17 00:00:00 2001 From: barteksekula Date: Sun, 14 Apr 2019 19:13:05 +0200 Subject: [PATCH 2/2] use const key for new&unsaved locations if the location does not have an id yet (was not stored in epi yet) we will use a temporary key to avoid react warning --- src/ui/reviewLocationsCollection.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ui/reviewLocationsCollection.tsx b/src/ui/reviewLocationsCollection.tsx index 94fc92c3..9525f074 100644 --- a/src/ui/reviewLocationsCollection.tsx +++ b/src/ui/reviewLocationsCollection.tsx @@ -31,7 +31,7 @@ export default class ReviewLocationsCollection extends React.Component {filter.showPoints && locations.map(location => - this.onLocationClick(e, location)} /> + this.onLocationClick(e, location)} /> )} ) };