Merge "Ensure draftID is set when comparing two drafts"
diff --git a/polygerrit-ui/app/services/comments/comments-model.ts b/polygerrit-ui/app/services/comments/comments-model.ts
index b26ec9b..bbc7b1a 100644
--- a/polygerrit-ui/app/services/comments/comments-model.ts
+++ b/polygerrit-ui/app/services/comments/comments-model.ts
@@ -111,7 +111,7 @@
   if (!drafts[draft.path]) drafts[draft.path] = [] as DraftInfo[];
   else drafts[draft.path] = [...drafts[draft.path]];
   const index = drafts[draft.path].findIndex(
-    d => d.__draftID === draft.__draftID || d.id === draft.id
+    d => (d.__draftID && d.__draftID === draft.__draftID) || d.id === draft.id
   );
   if (index !== -1) {
     drafts[draft.path][index] = draft;
@@ -127,7 +127,7 @@
   nextState.drafts = {...nextState.drafts};
   const drafts = nextState.drafts;
   const index = (drafts[draft.path] || []).findIndex(
-    d => d.__draftID === draft.__draftID || d.id === draft.id
+    d => (d.__draftID && d.__draftID === draft.__draftID) || d.id === draft.id
   );
   if (index === -1) return;
   drafts[draft.path] = [...drafts[draft.path]];