Fix an issue when clicking on edit uses an old patchset
Only happens if you publish an edit and click on the edit button after.
Release-Notes: Fix an issue when clicking on edit uses an old patchset
Change-Id: I22fe25ed6dbab0b9d043fbd3d16fa692c2e576bb
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 7a4e5aa..2726b85 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
@@ -567,7 +567,7 @@
/** Simply reflects the router-model value. */
// visible for testing
- viewModelPatchNum?: PatchSetNum;
+ viewModelPatchNum?: RevisionPatchSetNum;
private readonly shortcutsController = new ShortcutController(this);
@@ -3152,19 +3152,10 @@
return;
}
- // Avoid putting patch set in the URL unless a non-latest patch set is
- // selected.
- assertIsDefined(this.patchRange, 'patchRange');
- let patchNum;
- if (
- !(this.patchRange.patchNum === computeLatestPatchNum(this.allPatchSets))
- ) {
- patchNum = this.patchRange.patchNum;
- }
this.getNavigation().setUrl(
createChangeUrl({
change: this.change,
- patchNum,
+ patchNum: this.viewModelPatchNum,
edit: true,
forceReload: true,
})
diff --git a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
index 34d11a3..577f925 100644
--- a/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
+++ b/polygerrit-ui/app/elements/change/gr-change-view/gr-change-view_test.ts
@@ -2187,7 +2187,7 @@
const newChange = {...element.change};
newChange.revisions.rev2 = createRevision(2);
element.change = newChange;
- element.patchRange = {patchNum: 1 as RevisionPatchSetNum};
+ element.viewModelPatchNum = 1 as RevisionPatchSetNum;
await element.updateComplete;
fireEdit();