Skip to content

Commit 3690110

Browse files
authored
fix(seer): Smooth summary anmiation, no initial animation (#100924)
uses framer motion to disable animation when the drawer is opening and remove chunky-ness when collapsing before https://github.com/user-attachments/assets/83d3b010-f333-4fc3-80a6-098428c8f917 after https://github.com/user-attachments/assets/ab626802-058d-45eb-bbd3-226aa5e527d4
1 parent 204a5f1 commit 3690110

File tree

1 file changed

+29
-23
lines changed

1 file changed

+29
-23
lines changed

static/app/components/group/groupSummary.tsx

Lines changed: 29 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
1-
import {isValidElement, useEffect, useState} from 'react';
1+
import {isValidElement, useEffect, useLayoutEffect, useState} from 'react';
22
import styled from '@emotion/styled';
3+
import {motion} from 'framer-motion';
34

45
import {Button} from 'sentry/components/core/button';
6+
import {Flex} from 'sentry/components/core/layout';
57
import {Text} from 'sentry/components/core/text';
68
import {makeAutofixQueryKey} from 'sentry/components/events/autofix/useAutofix';
79
import Placeholder from 'sentry/components/placeholder';
@@ -21,6 +23,7 @@ import type {Project} from 'sentry/types/project';
2123
import {getConfigForIssueType} from 'sentry/utils/issueTypeConfig';
2224
import {MarkedText} from 'sentry/utils/marked/markedText';
2325
import {useApiQuery, useQueryClient, type ApiQueryKey} from 'sentry/utils/queryClient';
26+
import testableTransition from 'sentry/utils/testableTransition';
2427
import useOrganization from 'sentry/utils/useOrganization';
2528
import {useAiConfig} from 'sentry/views/issueDetails/streamline/hooks/useAiConfig';
2629

@@ -258,8 +261,7 @@ function GroupSummaryCollapsed({
258261
setIsExpanded(!isExpanded);
259262
};
260263

261-
useEffect(() => {
262-
// eslint-disable-next-line react-you-might-not-need-an-effect/no-derived-state
264+
useLayoutEffect(() => {
263265
setIsExpanded(!defaultCollapsed);
264266
}, [defaultCollapsed]);
265267

@@ -287,17 +289,29 @@ function GroupSummaryCollapsed({
287289
</CollapsedHeaderContent>
288290
</CollapsedHeader>
289291

290-
<ExpandableContent isExpanded={isExpanded}>
291-
<GroupSummaryFull
292-
group={group}
293-
project={project}
294-
data={data}
295-
isPending={isPending}
296-
isError={isError}
297-
preview={false}
298-
setForceEvent={setForceEvent}
299-
event={event}
300-
/>
292+
<ExpandableContent
293+
initial={false}
294+
animate={{height: isExpanded ? 'auto' : 0}}
295+
transition={testableTransition({
296+
type: 'spring',
297+
damping: 50,
298+
stiffness: 600,
299+
bounce: 0,
300+
visualDuration: 0.4,
301+
})}
302+
>
303+
<Flex paddingTop="lg">
304+
<GroupSummaryFull
305+
group={group}
306+
project={project}
307+
data={data}
308+
isPending={isPending}
309+
isError={isError}
310+
preview={false}
311+
setForceEvent={setForceEvent}
312+
event={event}
313+
/>
314+
</Flex>
301315
</ExpandableContent>
302316
</CollapsedContent>
303317
)}
@@ -528,14 +542,6 @@ const ChevronIcon = styled('div')`
528542
flex-shrink: 0;
529543
`;
530544

531-
const ExpandableContent = styled('div')<{isExpanded: boolean}>`
532-
max-height: ${p => (p.isExpanded ? '1000px' : '0')};
545+
const ExpandableContent = styled(motion.div)`
533546
overflow: hidden;
534-
transition: max-height 0.3s ease-in-out;
535-
536-
${p =>
537-
p.isExpanded &&
538-
`
539-
padding-top: ${p.theme.space.lg};
540-
`}
541547
`;

0 commit comments

Comments
 (0)