Fix `REVERTED` chips being shown twice
Release-Notes: skip
Google-Bug-Id: b/255782672
Google-Bug-Id: b/255807146
Change-Id: Idcb193203d36568044b2aa28374b8a1462a2393b
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
index c6d86a7..2810134 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view.ts
@@ -2684,6 +2684,11 @@
change => change?.status === ChangeStatus.MERGED
);
if (!this.changeStatuses) return;
+ // Protect against `computeRevertSubmitted()` being called twice.
+ // TODO: Convert this to be rxjs based, so computeRevertSubmitted() is not
+ // actively called, but instead we can subscribe to something.
+ if (this.changeStatuses.includes(ChangeStates.REVERT_SUBMITTED)) return;
+ if (this.changeStatuses.includes(ChangeStates.REVERT_CREATED)) return;
if (submittedRevert) {
this.revertedChange = submittedRevert;
this.changeStatuses = this.changeStatuses.concat([