1
- import { isValidElement , useEffect , useState } from 'react' ;
1
+ import { isValidElement , useEffect , useLayoutEffect , useState } from 'react' ;
2
2
import styled from '@emotion/styled' ;
3
+ import { motion } from 'framer-motion' ;
3
4
4
5
import { Button } from 'sentry/components/core/button' ;
6
+ import { Flex } from 'sentry/components/core/layout' ;
5
7
import { Text } from 'sentry/components/core/text' ;
6
8
import { makeAutofixQueryKey } from 'sentry/components/events/autofix/useAutofix' ;
7
9
import Placeholder from 'sentry/components/placeholder' ;
@@ -21,6 +23,7 @@ import type {Project} from 'sentry/types/project';
21
23
import { getConfigForIssueType } from 'sentry/utils/issueTypeConfig' ;
22
24
import { MarkedText } from 'sentry/utils/marked/markedText' ;
23
25
import { useApiQuery , useQueryClient , type ApiQueryKey } from 'sentry/utils/queryClient' ;
26
+ import testableTransition from 'sentry/utils/testableTransition' ;
24
27
import useOrganization from 'sentry/utils/useOrganization' ;
25
28
import { useAiConfig } from 'sentry/views/issueDetails/streamline/hooks/useAiConfig' ;
26
29
@@ -258,8 +261,7 @@ function GroupSummaryCollapsed({
258
261
setIsExpanded ( ! isExpanded ) ;
259
262
} ;
260
263
261
- useEffect ( ( ) => {
262
- // eslint-disable-next-line react-you-might-not-need-an-effect/no-derived-state
264
+ useLayoutEffect ( ( ) => {
263
265
setIsExpanded ( ! defaultCollapsed ) ;
264
266
} , [ defaultCollapsed ] ) ;
265
267
@@ -287,17 +289,29 @@ function GroupSummaryCollapsed({
287
289
</ CollapsedHeaderContent >
288
290
</ CollapsedHeader >
289
291
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 >
301
315
</ ExpandableContent >
302
316
</ CollapsedContent >
303
317
) }
@@ -528,14 +542,6 @@ const ChevronIcon = styled('div')`
528
542
flex-shrink: 0;
529
543
` ;
530
544
531
- const ExpandableContent = styled ( 'div' ) < { isExpanded : boolean } > `
532
- max-height: ${ p => ( p . isExpanded ? '1000px' : '0' ) } ;
545
+ const ExpandableContent = styled ( motion . div ) `
533
546
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
- ` }
541
547
` ;
0 commit comments