@devries-cameron20 / t3code-1 / commits / 0847a448fd
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

fix(mobile): merge button names merged, closed, draft, and conflict states (#29486)

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>

Julius Marminge committed Nov 2, 2026 at 09:54 UTC 0847a448fdca5a688720050ca706cbbd37e6347e
2 files changed +69 -38
apps/mobile/src/features/pull-requests/PullRequestMergeControls.tsx
+68 -35
@@ -16,14 +16,16 @@ import {
16 allowedMergeMethods,
17 canPerformPullRequestAction,
18 mergeUnavailableReason,
19 - MERGE_CONFLICT_REASON,
19 MERGE_METHODS,
20 + PR_ACTION_ICONS,
21 pullRequestActionLabel,
22 } from "./pullRequestActions";
23 import { pullRequestStackMerge, singlePullRequestMergeAllowed } from "./pullRequestStack";
24 import { pullRequestTarget, type PullRequestParams } from "./usePullRequestDiff";
25 +import { usePullRequestAction } from "./usePullRequestAction";
26 import { usePullRequestPermissions } from "./usePullRequestPermissions";
27 import { PullRequestGlyph } from "./pullRequestGlyphs";
28 +import type { AppSymbolName } from "../../components/ui/AppSymbol";
29 import type { PullRequestStackState } from "./usePullRequestStack";
30
31 export function PullRequestMergeControls(props: {
@@ -35,6 +37,7 @@ export function PullRequestMergeControls(props: {
37 const terminology = sourceControlClients.get(pr.provider).changeRequest;
38 const target = pullRequestTarget(props.params);
39 const permissions = usePullRequestPermissions(props.params, pr);
40 + const stateAction = usePullRequestAction(props.params, pr);
41 const preferences = useAtomValue(mobilePreferencesAtom);
42 const savePreferences = useAtomSet(updateMobilePreferencesAtom);
43 const runAction = useAtomCommand(composerPullRequests.runAction, { reportFailure: false });
@@ -82,8 +85,39 @@ export function PullRequestMergeControls(props: {
85 ? `${MERGE_METHODS[method].title} stack (${scope.layers.length})`
86 : MERGE_METHODS[method].title
87 : "Merge unavailable";
85 - const autoMergeArmed = pr.state === "open" && pr.autoMergeEnabled === true;
86 - const armedLabel = `Auto-merge pending${pr.autoMergeMethod ? ` (${pr.autoMergeMethod})` : ""}`;
88 + const nextAction =
89 + pr.state === "closed" ? "reopen" : pr.state === "open" && pr.isDraft ? "ready" : null;
90 + // States the button itself names, instead of a reason line under it. Draft and
91 + // closed offer their way forward when the viewer can take it.
92 + const status: {
93 + label: string;
94 + icon: AppSymbolName;
95 + final?: boolean;
96 + action?: "ready" | "reopen";
97 + } | null =
98 + nextAction && stateAction.available(nextAction)
99 + ? {
100 + label: pullRequestActionLabel(nextAction, terminology),
101 + icon: PR_ACTION_ICONS[nextAction],
102 + final: nextAction === "reopen",
103 + action: nextAction,
104 + }
105 + : pr.state === "merged"
106 + ? { label: "Merged", icon: PullRequestGlyph.merged, final: true }
107 + : pr.state === "closed"
108 + ? { label: "Closed", icon: PullRequestGlyph.closed, final: true }
109 + : pr.isDraft
110 + ? { label: "Draft", icon: PullRequestGlyph.draft }
111 + : pr.mergeability === "conflicting"
112 + ? { label: "Resolve conflicts to merge", icon: PullRequestGlyph.conflicting }
113 + : pr.autoMergeEnabled
114 + ? {
115 + label: `Auto-merge pending${pr.autoMergeMethod ? ` (${pr.autoMergeMethod})` : ""}`,
116 + icon: "clock",
117 + }
118 + : checkingStack && !busy
119 + ? { label: "Checking stack…", icon: PullRequestGlyph.merged }
120 + : null;
121 const autoAction = pr.autoMergeEnabled ? "disable-auto-merge" : "enable-auto-merge";
122 const canAutoMerge =
123 !busy &&
@@ -170,43 +204,47 @@ export function PullRequestMergeControls(props: {
204 <View className="gap-2 border-t border-border-subtle p-3">
205 <SplitButton
206 label={
173 - busy
207 + busy || stateAction.busy
208 ? "Working…"
209 : !permissions.connected
210 ? "Reconnect to merge"
177 - : autoMergeArmed
178 - ? armedLabel
179 - : label
211 + : (status?.label ?? label)
212 }
213 accessibilityLabel={
182 - autoMergeArmed
183 - ? `${armedLabel}, merges once its requirements are met`
214 + status
215 + ? status.label
216 : scope
217 ? `${label}, ${scope.layers.length} stack layers through #${pr.number}`
218 : label
219 }
188 - icon={autoMergeArmed ? "clock" : PullRequestGlyph.merged}
189 - disabled={!canMerge || autoMergeArmed}
190 - loading={busy || (!autoMergeArmed && checkingStack)}
191 - onPress={() => confirm("merge")}
220 + icon={status?.icon ?? PullRequestGlyph.merged}
221 + disabled={status?.action ? stateAction.busy : !canMerge || status !== null}
222 + loading={busy || stateAction.busy || (!status?.action && checkingStack)}
223 + onPress={() =>
224 + status?.action ? void stateAction.perform(status.action) : confirm("merge")
225 + }
226 menuTitle="Merge options"
193 - actions={[
194 - ...methods.map((id) => ({
195 - id,
196 - title: MERGE_METHODS[id].title,
197 - state: id === method ? ("on" as const) : ("off" as const),
198 - attributes: { disabled: !canMerge && !canAutoMerge },
199 - })),
200 - ...(canAutoMerge
201 - ? [
202 - {
203 - id: autoAction,
204 - title: pr.autoMergeEnabled ? "Disable auto-merge" : "Enable auto-merge",
205 - image: "clock",
206 - },
227 + actions={
228 + status?.final
229 + ? []
230 + : [
231 + ...methods.map((id) => ({
232 + id,
233 + title: MERGE_METHODS[id].title,
234 + state: id === method ? ("on" as const) : ("off" as const),
235 + attributes: { disabled: !canMerge && !canAutoMerge },
236 + })),
237 + ...(canAutoMerge
238 + ? [
239 + {
240 + id: autoAction,
241 + title: pr.autoMergeEnabled ? "Disable auto-merge" : "Enable auto-merge",
242 + image: "clock",
243 + },
244 + ]
245 + : []),
246 ]
208 - : []),
209 - ]}
247 + }
248 onPressAction={(id) => {
249 const selected = methods.find((method) => method === id);
250 if (selected) {
@@ -215,12 +253,7 @@ export function PullRequestMergeControls(props: {
253 } else if (id === autoAction && canAutoMerge) confirm(autoAction);
254 }}
255 />
218 - {permissions.connected &&
219 - !autoMergeArmed &&
220 - reason &&
221 - reason !== MERGE_CONFLICT_REASON &&
222 - reason !== "Checking stack membership…" &&
223 - !(checkingStack && reason === "Refresh the stack before merging.") ? (
256 + {permissions.connected && !status && reason ? (
257 <Text className="px-1 text-xs text-foreground-muted">{reason}</Text>
258 ) : null}
259 {stack.error && stack.supportsStackActions ? (
apps/mobile/src/features/pull-requests/pullRequestActions.ts
+1 -3
@@ -117,8 +117,6 @@ export function canPerformPullRequestAction(pr: ActionDetail, action: PullReques
117 }
118 }
119
120 -export const MERGE_CONFLICT_REASON = "Resolve the branch conflicts before merging.";
121 -
120 export function mergeUnavailableReason(
121 pr: ActionDetail,
122 connectionAllowsWrites: boolean,
@@ -132,7 +130,7 @@ export function mergeUnavailableReason(
130 if (!pr.viewerPermissions.actions.includes("merge"))
131 return `Your account cannot merge this ${terminology.singular}.`;
132 if (pr.isDraft) return "Mark this draft ready for review before merging.";
135 - if (pr.mergeability === "conflicting") return MERGE_CONFLICT_REASON;
133 + if (pr.mergeability === "conflicting") return "Resolve the branch conflicts before merging.";
134 if (!allowedMergeMethods(pr).length) return "This repository has no available merge methods.";
135 return null;
136 }