Skip to content

Commit

Permalink
fix(issue summary): Hide trace section when loading (#81632)
Browse files Browse the repository at this point in the history
Hide the "in the trace" section in the summary when loading, and only
show it if we get data for it.

<img width="365" alt="Screenshot 2024-12-03 at 2 44 58 PM"
src="https://github.com/user-attachments/assets/53ebf9c5-af23-4efe-8b13-7fe0bff8cfb3">
<img width="352" alt="Screenshot 2024-12-03 at 2 45 04 PM"
src="https://github.com/user-attachments/assets/487198ab-61cb-406d-b2b6-69eafcad7c93">
  • Loading branch information
roaga authored Dec 3, 2024
1 parent 131a06c commit 9b58a82
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion static/app/components/group/groupSummary.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ describe('GroupSummary', function () {
render(<GroupSummary data={undefined} isError={false} isPending />);

// Should show loading placeholders
expect(screen.getAllByTestId('loading-placeholder')).toHaveLength(3); // 3 placeholder cards
expect(screen.getAllByTestId('loading-placeholder')).toHaveLength(2);
});

it('shows error state', function () {
Expand Down
6 changes: 5 additions & 1 deletion static/app/components/group/groupSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,21 @@ export function GroupSummary({
title: t("What's wrong"),
insight: data?.whatsWrong,
icon: <IconFatal size="sm" />,
showWhenLoading: true,
},
{
id: 'trace',
title: t('In the trace'),
insight: data?.trace,
icon: <IconSpan size="sm" />,
showWhenLoading: false,
},
{
id: 'possible_cause',
title: t('Possible cause'),
insight: data?.possibleCause,
icon: <IconFocus size="sm" />,
showWhenLoading: true,
},
];

Expand All @@ -90,7 +93,8 @@ export function GroupSummary({
<InsightGrid>
{insightCards.map(card => {
// Hide the card if we're not loading and there's no insight
if (!isPending && !card.insight) {
// Also hide if we're loading and the card shouldn't show when loading
if ((!isPending && !card.insight) || (isPending && !card.showWhenLoading)) {
return null;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ describe('SolutionsSection', () => {
);

expect(screen.getByText('Solutions Hub')).toBeInTheDocument();
expect(screen.getAllByTestId('loading-placeholder')).toHaveLength(4);
expect(screen.getAllByTestId('loading-placeholder')).toHaveLength(3);
});

it('renders summary when AI features are enabled and data is available', async () => {
Expand Down

0 comments on commit 9b58a82

Please sign in to comment.