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
This commit is contained in:
1 parent
07187d3794
commit
1fe3cf53a7
2 files changed
+8
-7
No files matched your search
@@ -272,9 +272,9 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
|
||||
const prUrl = result.pr.url ?? gitStatus?.openPr?.url;
|
||||
const shouldOfferPushCta = action === "commit" && result.commit.status === "created";
|
||||
const shouldOfferOpenPrCta =
|
||||
(action === "commit_push" || action === "commit_push_pr") && !!prUrl;
|
||||
(action === "commit_push" || action === "commit_push_pr") && !!prUrl && !isDefaultBranch;
|
||||
const shouldOfferCreatePrCta =
|
||||
action === "commit_push" && !prUrl && result.push.status === "pushed";
|
||||
action === "commit_push" && !prUrl && result.push.status === "pushed" && !isDefaultBranch;
|
||||
const closeResultToast = () => {
|
||||
toastManager.close(progressToastId);
|
||||
};
|
||||
@@ -329,6 +329,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
|
||||
api,
|
||||
gitStatus?.hasWorkingTreeChanges,
|
||||
gitStatus?.openPr?.url,
|
||||
isDefaultBranch,
|
||||
maybeConfirmPushToDefaultBranch,
|
||||
runImmediateGitActionMutation,
|
||||
setActiveDialogAction,
|
||||
@@ -449,7 +450,7 @@ export default function GitActionsControl({ api, gitCwd }: GitActionsControlProp
|
||||
render={
|
||||
<Button
|
||||
aria-disabled="true"
|
||||
className="cursor-not-allowed opacity-64"
|
||||
className="cursor-not-allowed rounded-e-none border-e-0 opacity-64 before:rounded-e-none"
|
||||
size="xs"
|
||||
variant="outline"
|
||||
/>
|
||||
|
||||
@@ -108,8 +108,8 @@ export function gitRunStackedActionMutationOptions(input: {
|
||||
...(commitMessage ? { commitMessage } : {}),
|
||||
});
|
||||
},
|
||||
onSuccess: async () => {
|
||||
await invalidateGitQueries(input.queryClient);
|
||||
onSuccess: () => {
|
||||
void invalidateGitQueries(input.queryClient);
|
||||
},
|
||||
});
|
||||
}
|
||||
@@ -124,8 +124,8 @@ export function gitPullMutationOptions(input: {
|
||||
if (!input.api || !input.cwd) throw new Error("Git pull is unavailable.");
|
||||
return input.api.git.pull({ cwd: input.cwd });
|
||||
},
|
||||
onSuccess: async () => {
|
||||
await invalidateGitQueries(input.queryClient);
|
||||
onSuccess: () => {
|
||||
void invalidateGitQueries(input.queryClient);
|
||||
},
|
||||
});
|
||||
}
|
||||
Reference in new issue
Block a user