diff --git a/appview/pages/pages.go b/appview/pages/pages.go
--- a/appview/pages/pages.go
+++ b/appview/pages/pages.go
@@ -1428,6 +1428,10 @@
ResubmitCheck ResubmitResult
BranchDeleteStatus *models.BranchDeleteStatus
Stack models.Stack
+
+ // renders buttons in a pre-check state and attaches the hx-trigger="load"
+ // that fetches the real, checked fragment
+ Loading bool
}
func (p *Pages) PullActionsFragment(w io.Writer, params PullActionsParams) error {
diff --git a/appview/pulls/single.go b/appview/pulls/single.go
--- a/appview/pulls/single.go
+++ b/appview/pulls/single.go
@@ -58,11 +58,16 @@
return
}
- mergeCheckResponse := s.mergeCheck(r, f, pull, stack)
+ // only the last round's buttons and banners use merge/resubmit checks
+ isLastRound := roundNumber == pull.LastRoundNumber()
branchDeleteStatus := s.branchDeleteStatus(r, f, pull)
+ mergeCheckResponse := types.MergeCheckResponse{}
resubmitResult := pages.Unknown
- if user.Did == pull.OwnerDid {
- resubmitResult = s.resubmitCheck(r, f, pull, stack)
+ if isLastRound {
+ mergeCheckResponse = s.mergeCheck(r, f, pull, stack)
+ if user != nil && user.Did == pull.OwnerDid {
+ resubmitResult = s.resubmitCheck(r, f, pull, stack)
+ }
}
s.pages.PullActionsFragment(w, pages.PullActionsParams{
@@ -144,13 +149,6 @@
// can be nil if this pull is not stacked
stack, _ := r.Context().Value("stack").(models.Stack)
-
- mergeCheckResponse := s.mergeCheck(r, f, pull, stack)
- branchDeleteStatus := s.branchDeleteStatus(r, f, pull)
- resubmitResult := pages.Unknown
- if user != nil && user.Did == pull.OwnerDid {
- resubmitResult = s.resubmitCheck(r, f, pull, stack)
- }
m := make(map[string]models.Pipeline)
@@ -256,9 +254,9 @@
Pull: pull,
Stack: stack,
Backlinks: backlinks,
- BranchDeleteStatus: branchDeleteStatus,
- MergeCheck: mergeCheckResponse,
- ResubmitCheck: resubmitResult,
+ BranchDeleteStatus: nil,
+ MergeCheck: types.MergeCheckResponse{},
+ ResubmitCheck: pages.Unknown,
Pipelines: m,
Diff: diff,
DiffOpts: diffOpts,
diff --git a/appview/pages/templates/repo/pulls/pull.html b/appview/pages/templates/repo/pulls/pull.html
--- a/appview/pages/templates/repo/pulls/pull.html
+++ b/appview/pages/templates/repo/pulls/pull.html
@@ -311,7 +311,14 @@
{{ template "submissionCommits" $ }}
{{ template "submissionPipeline" $ }}
{{ if eq $lastIdx $round }}
- {{ block "mergeCheck" $root }} {{ end }}
+
+ {{ if $root.Pull.State.IsOpen }}
+
+ {{ i "loader-circle" "w-4 h-4 animate-spin" }}
+ Checking mergeability…
+
+ {{ end }}
+
{{ end }}
@@ -444,51 +451,6 @@
{{ end }}
{{ end }}
-{{ define "mergeCheck" }}
- {{ $isOpen := .Pull.State.IsOpen }}
- {{ if and $isOpen .MergeCheck .MergeCheck.Error }}
-
- {{ i "triangle-alert" "w-4 h-4" }}
- {{ .MergeCheck.Error }}
-
- {{ else if and $isOpen .MergeCheck .MergeCheck.IsConflicted }}
-
-
-
- {{ i "triangle-alert" "w-4 h-4" }}
-
Merge conflicts detected
-
- Expand
- Collapse
-
-
-
- {{ if gt (len .MergeCheck.Conflicts) 0 }}
-
- {{ range .MergeCheck.Conflicts }}
- {{ if .Filename }}
- -
- {{ i "file-warning" "inline-flex w-4 h-4 mr-1.5 text-red-600 dark:text-red-500 flex-shrink-0" }}
- {{ .Filename }}
-
- {{ else if .Reason }}
- -
- {{ i "file-warning" "w-4 h-4 mr-1.5 text-red-600 dark:text-red-500 " }}
- {{.Reason}}
-
- {{ end }}
- {{ end }}
-
- {{ end }}
-
- {{ else if and $isOpen .MergeCheck }}
-
- {{ i "check" "w-4 h-4" }}
- No conflicts, ready to merge
-
- {{ end }}
-{{ end }}
-
{{ define "mergeStatus" }}
{{ if .Pull.State.IsClosed }}
@@ -511,17 +473,6 @@
{{ i "git-pull-request-closed" "w-4 h-4" }}
This pull has been deleted (possibly by jj abandon or jj squash)
-
-
- {{ end }}
-{{ end }}
-
-{{ define "resubmitStatus" }}
- {{ if .ResubmitCheck.Yes }}
-
-
- {{ i "triangle-alert" "w-4 h-4" }}
- This branch has been updated, consider resubmitting
{{ end }}
@@ -612,24 +563,25 @@
{{ if eq $lastIdx $item.RoundNumber }}
{{ block "mergeStatus" $root }} {{ end }}
- {{ block "resubmitStatus" $root }} {{ end }}
+
{{ end }}
{{ if $root.LoggedInUser }}
- {{ template "repo/pulls/fragments/pullActions"
- (dict
- "LoggedInUser" $root.LoggedInUser
- "Pull" $root.Pull
- "RepoInfo" $root.RepoInfo
- "RoundNumber" $item.RoundNumber
- "MergeCheck" $root.MergeCheck
- "ResubmitCheck" $root.ResubmitCheck
- "BranchDeleteStatus" $root.BranchDeleteStatus
- "Stack" $root.Stack) }}
{{ end }}
+ {{ template "repo/pulls/fragments/pullActions"
+ (dict
+ "LoggedInUser" $root.LoggedInUser
+ "Pull" $root.Pull
+ "RepoInfo" $root.RepoInfo
+ "RoundNumber" $item.RoundNumber
+ "MergeCheck" $root.MergeCheck
+ "ResubmitCheck" $root.ResubmitCheck
+ "BranchDeleteStatus" $root.BranchDeleteStatus
+ "Stack" $root.Stack
+ "Loading" (eq $lastIdx $item.RoundNumber)) }}
{{ end }}
diff --git a/appview/pages/templates/repo/pulls/fragments/pullActions.html b/appview/pages/templates/repo/pulls/fragments/pullActions.html
--- a/appview/pages/templates/repo/pulls/fragments/pullActions.html
+++ b/appview/pages/templates/repo/pulls/fragments/pullActions.html
@@ -2,6 +2,7 @@
{{ $lastIdx := sub (len .Pull.Submissions) 1 }}
{{ $roundNumber := .RoundNumber }}
{{ $stack := .Stack }}
+ {{ $loading := .Loading }}
{{ $totalPulls := sub 0 1 }}
{{ $below := sub 0 1 }}
@@ -22,16 +23,24 @@
{{ $isLastRound := eq $roundNumber $lastIdx }}
{{ $isSameRepoBranch := .Pull.IsBranchBased }}
{{ $isUpToDate := .ResubmitCheck.No }}
-
-
+
+ {{ if and (not $loading) $isLastRound }}
+ {{ template "mergeCheck" . }}
+ {{ template "resubmitStatus" . }}
+ {{ end }}
+{{ end }}
+
+{{ define "mergeCheck" }}
+ {{ $isOpen := .Pull.State.IsOpen }}
+ {{ if and $isOpen .MergeCheck .MergeCheck.Error }}
+
+ {{ i "triangle-alert" "w-4 h-4" }}
+ {{ .MergeCheck.Error }}
+
+ {{ else if and $isOpen .MergeCheck .MergeCheck.IsConflicted }}
+
+
+
+ {{ i "triangle-alert" "w-4 h-4" }}
+
Merge conflicts detected
+
+ Expand
+ Collapse
+
+
+
+ {{ if gt (len .MergeCheck.Conflicts) 0 }}
+
+ {{ range .MergeCheck.Conflicts }}
+ {{ if .Filename }}
+ -
+ {{ i "file-warning" "inline-flex w-4 h-4 mr-1.5 text-red-600 dark:text-red-500 flex-shrink-0" }}
+ {{ .Filename }}
+
+ {{ else if .Reason }}
+ -
+ {{ i "file-warning" "w-4 h-4 mr-1.5 text-red-600 dark:text-red-500 " }}
+ {{.Reason}}
+
+ {{ end }}
+ {{ end }}
+
+ {{ end }}
+
+ {{ else if and $isOpen .MergeCheck }}
+
+ {{ i "check" "w-4 h-4" }}
+ No conflicts, ready to merge
+
+ {{ end }}
+{{ end }}
+
+{{ define "resubmitStatus" }}
+ {{ if .ResubmitCheck.Yes }}
+
+
+ {{ i "triangle-alert" "w-4 h-4" }}
+ This branch has been updated, consider resubmitting
+
+
+ {{ end }}
{{ end }}