authorgravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-14 23:53:29-08:00
committergravatar for julius0216@outlook.comJulius Marminge <julius0216@outlook.com> 2026-02-14 23:53:29-08:00
log1fe3cf53a7ea192bc1b440dfeb5c6a3b3a75b12d
tree9df763b3b07cb044c031d199ceae6b9e33d86de9
parent07187d3794ad8d2290f9795fae6662091100fc6b

Hide PR CTAs on default branch and make git invalidation non-blocking

- Only show open/create PR actions after push on non-default branches - Fire git query invalidation without awaiting mutation success handlers - Tweak disabled button classes to keep split-button borders/radii aligned

2 files changed, 8 insertions(+), 7 deletions(-)

apps/web/src/components/GitActionsControl.tsx+4-3
...@@ -272,9 +272,9 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp...@@ -272,9 +272,9 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
272 const prUrl = result.pr.url ?? gitStatus?.openPr?.url;272 const prUrl = result.pr.url ?? gitStatus?.openPr?.url;
273 const shouldOfferPushCta = action === "commit" && result.commit.status === "created";273 const shouldOfferPushCta = action === "commit" && result.commit.status === "created";
274 const shouldOfferOpenPrCta =274 const shouldOfferOpenPrCta =
275 (action === "commit_push" || action === "commit_push_pr") && !!prUrl;275 (action === "commit_push" || action === "commit_push_pr") && !!prUrl && !isDefaultBranch;
276 const shouldOfferCreatePrCta =276 const shouldOfferCreatePrCta =
277 action === "commit_push" && !prUrl && result.push.status === "pushed";277 action === "commit_push" && !prUrl && result.push.status === "pushed" && !isDefaultBranch;
278 const closeResultToast = () => {278 const closeResultToast = () => {
279 toastManager.close(progressToastId);279 toastManager.close(progressToastId);
280 };280 };
...@@ -329,6 +329,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp...@@ -329,6 +329,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
329 api,329 api,
330 gitStatus?.hasWorkingTreeChanges,330 gitStatus?.hasWorkingTreeChanges,
331 gitStatus?.openPr?.url,331 gitStatus?.openPr?.url,
332 isDefaultBranch,
332 maybeConfirmPushToDefaultBranch,333 maybeConfirmPushToDefaultBranch,
333 runImmediateGitActionMutation,334 runImmediateGitActionMutation,
334 setActiveDialogAction,335 setActiveDialogAction,
...@@ -449,7 +450,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp...@@ -449,7 +450,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
449 render={450 render={
450 <Button451 <Button
451 aria-disabled="true"452 aria-disabled="true"
452 className="cursor-not-allowed opacity-64"453 className="cursor-not-allowed rounded-e-none border-e-0 opacity-64 before:rounded-e-none"
453 size="xs"454 size="xs"
454 variant="outline"455 variant="outline"
455 />456 />
apps/web/src/lib/gitReactQuery.ts+4-4
...@@ -108,8 +108,8 @@ export function gitRunStackedActionMutationOptions(input: {...@@ -108,8 +108,8 @@ export function gitRunStackedActionMutationOptions(input: {
108 ...(commitMessage ? { commitMessage } : {}),108 ...(commitMessage ? { commitMessage } : {}),
109 });109 });
110 },110 },
111 onSuccess: async () => {111 onSuccess: () => {
112 await invalidateGitQueries(input.queryClient);112 void invalidateGitQueries(input.queryClient);
113 },113 },
114 });114 });
115}115}
...@@ -124,8 +124,8 @@ export function gitPullMutationOptions(input: {...@@ -124,8 +124,8 @@ export function gitPullMutationOptions(input: {
124 if (!input.api || !input.cwd) throw new Error("Git pull is unavailable.");124 if (!input.api || !input.cwd) throw new Error("Git pull is unavailable.");
125 return input.api.git.pull({ cwd: input.cwd });125 return input.api.git.pull({ cwd: input.cwd });
126 },126 },
127 onSuccess: async () => {127 onSuccess: () => {
128 await invalidateGitQueries(input.queryClient);128 void invalidateGitQueries(input.queryClient);
129 },129 },
130 });130 });
131}131}