Skip to content

Commit 900af8d

Browse files
fix(autofix): Show PR card with creating/updating state on confirm
When user clicks to create/update PR, immediately hide the NextStep prompt and show the PR card with a disabled "Creating/Updating PR" button. The button text distinguishes between new PRs and updates. The PR section now also appears during the 'creating' status, not just when fully in sync. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent e519006 commit 900af8d

File tree

3 files changed

+12
-15
lines changed

3 files changed

+12
-15
lines changed

static/app/components/events/autofix/useExplorerAutofix.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,17 +376,19 @@ export function getOrderedAutofixSections(runState: ExplorerAutofixState | null)
376376
);
377377

378378
if (hasCompletedCodeChanges) {
379-
// Only show the PR section when all PRs are in sync with current code.
380-
// Otherwise the NextStep prompt handles create/update flow.
379+
// Show the PR section when PRs are in sync (View links) or when a PR
380+
// is being created/updated (disabled button with loading text).
381+
// Hide it when PRs are out of sync — the NextStep prompt handles that.
381382
const repoPRStates = runState?.repo_pr_states ?? {};
382-
if (areAllPRsInSync(blocks, repoPRStates)) {
383-
const pullRequests = Object.values(repoPRStates);
383+
const pullRequests = Object.values(repoPRStates);
384+
const anyCreating = pullRequests.some(pr => pr.pr_creation_status === 'creating');
385+
if (anyCreating || areAllPRsInSync(blocks, repoPRStates)) {
384386
sections.push({
385387
step: 'pull_request',
386388
blockIndex: blocks.length,
387389
artifacts: [pullRequests],
388390
messages: [],
389-
status: 'completed',
391+
status: anyCreating ? 'processing' : 'completed',
390392
});
391393
}
392394

static/app/components/events/autofix/v3/autofixCards.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -329,9 +329,12 @@ export function PullRequestsCard({autofix, section}: AutofixCardProps) {
329329
>
330330
{artifact?.map(pullRequest => {
331331
if (pullRequest.pr_creation_status === 'creating') {
332+
const isUpdating = !!(pullRequest.pr_number && pullRequest.pr_url);
332333
return (
333334
<Button key={pullRequest.repo_name} priority="primary" disabled>
334-
{t('Creating PR in %s', pullRequest.repo_name)}
335+
{isUpdating
336+
? t('Updating PR in %s', pullRequest.repo_name)
337+
: t('Creating PR in %s', pullRequest.repo_name)}
335338
</Button>
336339
);
337340
}

static/app/components/events/autofix/v3/nextStep.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -253,18 +253,10 @@ function CodeChangesNextStep({autofix, group, runId, section, referrer}: NextSte
253253
[autofix.runState?.blocks, autofix.runState?.repo_pr_states]
254254
);
255255

256-
if (!defined(artifact) || allInSync) {
256+
if (!defined(artifact) || allInSync || creatingPR) {
257257
return null;
258258
}
259259

260-
if (creatingPR) {
261-
return (
262-
<Text variant="muted">
263-
{hasPR ? t('Updating PR\u2026') : t('Creating PR\u2026')}
264-
</Text>
265-
);
266-
}
267-
268260
const yesLabel = hasPR ? t('Yes, update the PR') : t('Yes, draft a PR');
269261
const nevermindLabel = hasPR
270262
? t('Nevermind, update the PR')

0 commit comments

Comments
 (0)