1
- import type { ReactNode } from 'react' ;
2
1
import styled from '@emotion/styled' ;
3
2
4
3
import NegativeSpaceContainer from 'sentry/components/container/negativeSpaceContainer' ;
@@ -30,43 +29,45 @@ interface Props {
30
29
}
31
30
32
31
export default function ReplayDiffContent ( { event, group, orgSlug, replaySlug} : Props ) {
33
- function wrapInSection ( render : ( ) => ReactNode ) {
34
- return function ( ) {
35
- return (
36
- < InterimSection
37
- type = { SectionKey . HYDRATION_DIFF }
38
- title = { t ( 'Hydration Error Diff' ) }
39
- >
40
- { render ( ) }
41
- </ InterimSection >
42
- ) ;
43
- } ;
44
- }
45
-
46
32
const organization = useOrganization ( ) ;
47
33
const readerResult = useLoadReplayReader ( {
48
34
orgSlug : organization . slug ,
49
35
replaySlug,
50
36
clipWindow : undefined ,
51
37
} ) ;
52
38
39
+ const sectionProps = {
40
+ type : SectionKey . HYDRATION_DIFF ,
41
+ title : t ( 'Hydration Error Diff' ) ,
42
+ } ;
43
+
53
44
return (
54
45
< ReplayLoadingState
55
46
readerResult = { readerResult }
56
- renderArchived = { wrapInSection ( ( ) => (
57
- < ArchivedReplayAlert message = { t ( 'The replay for this event has been deleted.' ) } />
58
- ) ) }
59
- renderLoading = { wrapInSection ( ( ) => (
60
- < StyledNegativeSpaceContainer data-test-id = "replay-diff-loading-placeholder" >
61
- < LoadingIndicator />
62
- </ StyledNegativeSpaceContainer >
63
- ) ) }
64
- renderError = { wrapInSection ( ( ) => (
65
- < MissingReplayAlert orgSlug = { orgSlug } />
66
- ) ) }
67
- renderMissing = { wrapInSection ( ( ) => (
68
- < MissingReplayAlert orgSlug = { orgSlug } />
69
- ) ) }
47
+ renderArchived = { ( ) => (
48
+ < InterimSection { ...sectionProps } >
49
+ < ArchivedReplayAlert
50
+ message = { t ( 'The replay for this event has been deleted.' ) }
51
+ />
52
+ </ InterimSection >
53
+ ) }
54
+ renderLoading = { ( ) => (
55
+ < InterimSection { ...sectionProps } >
56
+ < StyledNegativeSpaceContainer data-test-id = "replay-diff-loading-placeholder" >
57
+ < LoadingIndicator />
58
+ </ StyledNegativeSpaceContainer >
59
+ </ InterimSection >
60
+ ) }
61
+ renderError = { ( ) => (
62
+ < InterimSection { ...sectionProps } >
63
+ < MissingReplayAlert orgSlug = { orgSlug } />
64
+ </ InterimSection >
65
+ ) }
66
+ renderMissing = { ( ) => (
67
+ < InterimSection { ...sectionProps } >
68
+ < MissingReplayAlert orgSlug = { orgSlug } />
69
+ </ InterimSection >
70
+ ) }
70
71
>
71
72
{ ( { replay} ) => {
72
73
const { frameOrEvent, leftOffsetMs, rightOffsetMs} = getReplayDiffOffsetsFromEvent (
@@ -75,8 +76,7 @@ export default function ReplayDiffContent({event, group, orgSlug, replaySlug}: P
75
76
) ;
76
77
return (
77
78
< InterimSection
78
- type = { SectionKey . HYDRATION_DIFF }
79
- title = { t ( 'Hydration Error Diff' ) }
79
+ { ...sectionProps }
80
80
actions = {
81
81
< OpenReplayComparisonButton
82
82
frameOrEvent = { frameOrEvent }
0 commit comments