Skip to content

Commit 39d9961

Browse files
authored
fix(autofix): Fix bug in empty insights (#92086)
When an insights step has no cards, render the empty section as expected.
1 parent 4525724 commit 39d9961

File tree

1 file changed

+20
-22
lines changed

1 file changed

+20
-22
lines changed

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

Lines changed: 20 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,6 @@ interface CollapsibleChainLinkProps {
261261
groupId: string;
262262
runId: string;
263263
stepIndex: number;
264-
alignment?: 'start' | 'center';
265264
insightCount?: number;
266265
isCollapsed?: boolean;
267266
isEmpty?: boolean;
@@ -280,7 +279,6 @@ function CollapsibleChainLink({
280279
stepIndex,
281280
groupId,
282281
runId,
283-
alignment = 'center',
284282
}: CollapsibleChainLinkProps) {
285283
const [isAdding, setIsAdding] = useState(false);
286284
const [newInsightText, setNewInsightText] = useState('');
@@ -304,11 +302,8 @@ function CollapsibleChainLink({
304302
};
305303

306304
return (
307-
<VerticalLineContainer isEmpty={isEmpty} alignment={alignment}>
308-
<RethinkButtonContainer
309-
className="rethink-button-container"
310-
parentAlignment={alignment}
311-
>
305+
<VerticalLineContainer isEmpty={isEmpty}>
306+
<RethinkButtonContainer className="rethink-button-container">
312307
{showCollapseControl && onToggleCollapse && (
313308
<CollapseButtonWrapper
314309
onClick={onToggleCollapse}
@@ -450,7 +445,6 @@ function AutofixInsightCards({
450445
stepIndex={stepIndex}
451446
groupId={groupId}
452447
runId={runId}
453-
alignment="start"
454448
/>
455449
)}
456450
<AnimatePresence>
@@ -489,13 +483,23 @@ function AutofixInsightCards({
489483
runId={runId}
490484
insightCount={validInsightCount}
491485
showAddControl
492-
alignment="start"
493486
/>
494487
)}
495488
</Fragment>
496489
) : stepIndex === 0 && !hasStepBelow ? (
497490
<NoInsightsYet />
498-
) : null}
491+
) : (
492+
hasStepBelow && (
493+
<CollapsibleChainLink
494+
isEmpty={false}
495+
stepIndex={stepIndex}
496+
groupId={groupId}
497+
runId={runId}
498+
insightCount={validInsightCount}
499+
showAddControl
500+
/>
501+
)
502+
)}
499503
</CardsColumn>
500504
</InsightsGridContainer>
501505
);
@@ -621,7 +625,6 @@ const InsightContainer = styled(motion.div)<{expanded?: boolean}>`
621625
`;
622626

623627
const VerticalLineContainer = styled('div')<{
624-
alignment?: 'start' | 'center';
625628
isEmpty?: boolean;
626629
}>`
627630
position: relative;
@@ -630,10 +633,6 @@ const VerticalLineContainer = styled('div')<{
630633
display: flex;
631634
padding: 0;
632635
min-height: ${p => (p.isEmpty ? space(4) : 'auto')};
633-
634-
.rethink-button-container {
635-
/* Styles are now primarily in RethinkButtonContainer itself */
636-
}
637636
`;
638637

639638
const VerticalLine = styled('div')`
@@ -661,16 +660,15 @@ const CollapseButtonWrapper = styled('div')`
661660
}
662661
`;
663662

664-
const RethinkButtonContainer = styled('div')<{parentAlignment?: 'start' | 'center'}>`
663+
const RethinkButtonContainer = styled('div')`
665664
position: relative;
666665
display: flex;
667-
justify-content: ${p => (p.parentAlignment === 'start' ? 'flex-end' : 'center')};
666+
justify-content: flex-end;
668667
align-items: center;
669-
width: ${p => (p.parentAlignment === 'start' ? '100%' : 'max-content')};
670-
background: ${p =>
671-
p.parentAlignment === 'center' ? p.theme.background : 'transparent'};
672-
border-radius: ${p => (p.parentAlignment === 'center' ? '50%' : '0')};
673-
padding: ${p => (p.parentAlignment === 'center' ? space(0.25) : '0')};
668+
width: 100%;
669+
background: ${p => p.theme.background};
670+
border-radius: 0;
671+
padding: 0;
674672
z-index: 1;
675673
676674
&:has(> ${CollapseButtonWrapper}) {

0 commit comments

Comments
 (0)