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
272272 const prUrl = result.pr.url ?? gitStatus?.openPr?.url;
273273 const shouldOfferPushCta = action === "commit" && result.commit.status === "created";
274274 const shouldOfferOpenPrCta =
275 (action === "commit_push" || action === "commit_push_pr") && !!prUrl;
275 (action === "commit_push" || action === "commit_push_pr") && !!prUrl && !isDefaultBranch;
276276 const shouldOfferCreatePrCta =
277 action === "commit_push" && !prUrl && result.push.status === "pushed";
277 action === "commit_push" && !prUrl && result.push.status === "pushed" && !isDefaultBranch;
278278 const closeResultToast = () => {
279279 toastManager.close(progressToastId);
280280 };
......@@ -329,6 +329,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
329329 api,
330330 gitStatus?.hasWorkingTreeChanges,
331331 gitStatus?.openPr?.url,
332 isDefaultBranch,
332333 maybeConfirmPushToDefaultBranch,
333334 runImmediateGitActionMutation,
334335 setActiveDialogAction,
......@@ -449,7 +450,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
449450 render={
450451 <Button
451452 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"
453454 size="xs"
454455 variant="outline"
455456 />
apps/web/src/lib/gitReactQuery.ts+4-4
......@@ -108,8 +108,8 @@ export function gitRunStackedActionMutationOptions(input: {
108108 ...(commitMessage ? { commitMessage } : {}),
109109 });
110110 },
111 onSuccess: async () => {
112 await invalidateGitQueries(input.queryClient);
111 onSuccess: () => {
112 void invalidateGitQueries(input.queryClient);
113113 },
114114 });
115115}
......@@ -124,8 +124,8 @@ export function gitPullMutationOptions(input: {
124124 if (!input.api || !input.cwd) throw new Error("Git pull is unavailable.");
125125 return input.api.git.pull({ cwd: input.cwd });
126126 },
127 onSuccess: async () => {
128 await invalidateGitQueries(input.queryClient);
127 onSuccess: () => {
128 void invalidateGitQueries(input.queryClient);
129129 },
130130 });
131131}