Skip to content

Commit f34e5ff

Browse files
committed
less functional, more reacty
1 parent 4c55a71 commit f34e5ff

File tree

1 file changed

+30
-30
lines changed

1 file changed

+30
-30
lines changed

static/app/components/events/eventHydrationDiff/replayDiffContent.tsx

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import type {ReactNode} from 'react';
21
import styled from '@emotion/styled';
32

43
import NegativeSpaceContainer from 'sentry/components/container/negativeSpaceContainer';
@@ -30,43 +29,45 @@ interface Props {
3029
}
3130

3231
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-
4632
const organization = useOrganization();
4733
const readerResult = useLoadReplayReader({
4834
orgSlug: organization.slug,
4935
replaySlug,
5036
clipWindow: undefined,
5137
});
5238

39+
const sectionProps = {
40+
type: SectionKey.HYDRATION_DIFF,
41+
title: t('Hydration Error Diff'),
42+
};
43+
5344
return (
5445
<ReplayLoadingState
5546
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+
)}
7071
>
7172
{({replay}) => {
7273
const {frameOrEvent, leftOffsetMs, rightOffsetMs} = getReplayDiffOffsetsFromEvent(
@@ -75,8 +76,7 @@ export default function ReplayDiffContent({event, group, orgSlug, replaySlug}: P
7576
);
7677
return (
7778
<InterimSection
78-
type={SectionKey.HYDRATION_DIFF}
79-
title={t('Hydration Error Diff')}
79+
{...sectionProps}
8080
actions={
8181
<OpenReplayComparisonButton
8282
frameOrEvent={frameOrEvent}

0 commit comments

Comments
 (0)