Skip to content

Commit a1ce168

Browse files
roagaconstantinius
authored andcommitted
chore(autofix): Auto-add unsubmitted custom instructions (#98131)
If a user types out a custom instruction in the solution step but doesn't submit it, but then they press Code It Up, we now auto-submit it for them to prevent confusion.
1 parent ceed5c8 commit a1ce168

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

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

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,39 @@ function AutofixSolutionDisplay({
453453
[organization, solutionItems]
454454
);
455455

456+
const handleCodeItUp = () => {
457+
let finalSolutionItems = solutionItems;
458+
459+
// Check if there are instructions typed but not added
460+
if (instructions.trim()) {
461+
// Create a new step from the instructions input
462+
const newStep: AutofixSolutionTimelineEvent = {
463+
title: instructions,
464+
timeline_item_type: 'human_instruction',
465+
is_most_important_event: false,
466+
is_active: true,
467+
};
468+
469+
// Add the new step to the solution
470+
finalSolutionItems = [...solutionItems, newStep];
471+
setSolutionItems(finalSolutionItems);
472+
473+
// Clear the input
474+
setInstructions('');
475+
476+
trackAnalytics('autofix.solution.add_step', {
477+
organization,
478+
solution: solutionItems,
479+
newStep,
480+
});
481+
}
482+
483+
handleContinue({
484+
mode: 'fix',
485+
solution: finalSolutionItems,
486+
});
487+
};
488+
456489
useEffect(() => {
457490
setSolutionItems(
458491
solution.map(item => ({
@@ -614,12 +647,7 @@ function AutofixSolutionDisplay({
614647
}
615648
busy={isPending}
616649
disabled={hasNoRepos || cantReadRepos || codingDisabled}
617-
onClick={() => {
618-
handleContinue({
619-
mode: 'fix',
620-
solution: solutionItems,
621-
});
622-
}}
650+
onClick={handleCodeItUp}
623651
analyticsEventName="Autofix: Code It Up"
624652
analyticsEventKey="autofix.solution.code"
625653
title={t('Implement this solution in code with Seer')}

0 commit comments

Comments
 (0)