Skip to content

Commit e83afd1

Browse files
committed
ref: remove redundant fragment return types
1 parent 50cb859 commit e83afd1

File tree

28 files changed

+38
-59
lines changed

28 files changed

+38
-59
lines changed

static/app/components/actions/confirmableAction.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {Fragment} from 'react';
2-
31
import Confirm from 'sentry/components/confirm';
42

53
type ConfirmProps = React.ComponentProps<typeof Confirm>;
@@ -16,5 +14,5 @@ export default function ConfirmableAction({shouldConfirm, children, ...props}: P
1614
return <Confirm {...props}>{children as ConfirmProps['children']}</Confirm>;
1715
}
1816

19-
return <Fragment>{children as React.ReactNode}</Fragment>;
17+
return children;
2018
}

static/app/components/assistant/guideAnchor.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, Fragment, useEffect, useRef} from 'react';
1+
import {Component, useEffect, useRef} from 'react';
22
import styled from '@emotion/styled';
33
import * as Sentry from '@sentry/react';
44

@@ -212,7 +212,7 @@ type WrapperProps = Props & {
212212
*/
213213
function GuideAnchor({disabled, children, wrapperComponent, ...rest}: WrapperProps) {
214214
if (disabled) {
215-
return <Fragment>{children}</Fragment>;
215+
return children;
216216
}
217217
return (
218218
<BaseGuideAnchor wrapperComponent={wrapperComponent} {...rest}>

static/app/components/collapsible.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function Collapsible({
3535
const canCollapse = items.length > maxVisibleItems;
3636

3737
if (!canCollapse) {
38-
return <Fragment>{children}</Fragment>;
38+
return children;
3939
}
4040

4141
const visibleItems = isCollapsed ? items.slice(0, maxVisibleItems) : items;

static/app/components/highlight.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,14 @@ type Props = Omit<React.HTMLAttributes<HTMLDivElement>, keyof HighlightProps> &
2222
function HighlightComponent({className, children, disabled, text}: Props) {
2323
// There are instances when children is not string in breadcrumbs but not caught by TS
2424
if (!text || disabled || typeof children !== 'string') {
25-
return <Fragment>{children}</Fragment>;
25+
return children;
2626
}
2727

2828
const highlightText = text.toLowerCase();
2929
const idx = children.toLowerCase().indexOf(highlightText);
3030

3131
if (idx === -1) {
32-
return <Fragment>{children}</Fragment>;
32+
return children;
3333
}
3434

3535
return (

static/app/components/modals/debugFileCustomRepository/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ type Props = {
3535

3636
const HookedCustomSymbolSources = HookOrDefault({
3737
hookName: 'component:disabled-custom-symbol-sources',
38-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
38+
defaultComponent: ({children}) => children,
3939
});
4040

4141
function DebugFileCustomRepository({

static/app/components/modals/featureTourModal.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Component, Fragment} from 'react';
1+
import {Component} from 'react';
22
import styled from '@emotion/styled';
33

44
import type {ModalRenderProps} from 'sentry/actionCreators/modal';
@@ -118,8 +118,7 @@ class FeatureTourModal extends Component<Props, State> {
118118
};
119119

120120
render() {
121-
const {children} = this.props;
122-
return <Fragment>{children({showModal: this.handleShow})}</Fragment>;
121+
return this.props.children({showModal: this.handleShow});
123122
}
124123
}
125124

static/app/components/noProjectMessage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ function NoProjectMessage({
3737
: !!projects?.some(p => p.isMember && p.hasAccess);
3838

3939
if (hasProjectAccess || !projectsLoaded) {
40-
return <Fragment>{children}</Fragment>;
40+
return children;
4141
}
4242

4343
// If the organization has some projects, but the user doesn't have access to

static/app/components/organizations/pageFilters/container.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Fragment, useEffect, useLayoutEffect, useRef, useState} from 'react';
1+
import {useEffect, useLayoutEffect, useRef, useState} from 'react';
22
import isEqual from 'lodash/isEqual';
33

44
import type {InitializeUrlStateParams} from 'sentry/actionCreators/pageFilters';
@@ -203,7 +203,7 @@ function PageFiltersContainer({
203203
);
204204
}
205205

206-
return <Fragment>{children}</Fragment>;
206+
return children;
207207
}
208208

209209
export default PageFiltersContainer;

static/app/components/replays/header/feedbackButton.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import {Fragment} from 'react';
2-
31
import {FeatureFeedback} from 'sentry/components/featureFeedback';
42
import HookOrDefault from 'sentry/components/hookOrDefault';
53

64
const FeedbackButtonHook = HookOrDefault({
75
hookName: 'component:replay-feedback-button',
8-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
6+
defaultComponent: ({children}) => children,
97
});
108

119
function FeedbackButton() {

static/app/components/sidebar/sidebarItem.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {SIDEBAR_NAVIGATION_SOURCE} from './utils';
2626

2727
const LabelHook = HookOrDefault({
2828
hookName: 'sidebar:item-label',
29-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
29+
defaultComponent: ({children}) => children,
3030
});
3131

3232
const tooltipDisabledProps = {

static/app/components/teamRoleUtils.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
1-
import {Fragment} from 'react';
2-
31
import HookOrDefault from 'sentry/components/hookOrDefault';
42
import {t} from 'sentry/locale';
53

64
const LabelHook = HookOrDefault({
75
hookName: 'sidebar:item-label',
8-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
6+
defaultComponent: ({children}) => children,
97
});
108

119
export function TeamRoleColumnLabel() {

static/app/utils/measurements/measurements.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {Fragment} from 'react';
2-
31
import type {MobileVital, WebVital} from 'sentry/utils/fields';
42
import {
53
MOBILE_VITAL_DETAILS,
@@ -47,7 +45,7 @@ type Props = {
4745

4846
function Measurements({children}: Props) {
4947
const measurements = getMeasurements();
50-
return <Fragment>{children({measurements})}</Fragment>;
48+
return children({measurements});
5149
}
5250

5351
export default Measurements;

static/app/utils/performance/contexts/genericQueryBatcher.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {Ref} from 'react';
2-
import {createContext, Fragment, useEffect, useRef} from 'react';
2+
import {createContext, useEffect, useRef} from 'react';
33
import identity from 'lodash/identity';
44

55
import type {Client} from 'sentry/api';
@@ -237,7 +237,7 @@ export function QueryBatchNode(props: {
237237
try {
238238
batchContext = _useGenericQueryBatcher();
239239
} catch (_) {
240-
return <Fragment>{children({})}</Fragment>;
240+
return children({});
241241
}
242242

243243
function batchRequest(

static/app/utils/performanceForSentry/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {ProfilerOnRenderCallback, ReactNode} from 'react';
2-
import {Fragment, Profiler, useEffect, useRef} from 'react';
2+
import {Profiler, useEffect, useRef} from 'react';
33
import type {MeasurementUnit, Span, TransactionEvent} from '@sentry/core';
44
import {browserPerformanceTimeOrigin, timestampInSeconds} from '@sentry/core';
55
import * as Sentry from '@sentry/react';
@@ -229,12 +229,12 @@ export function VisuallyCompleteWithData({
229229
}, [_hasData, disabled, id]);
230230

231231
if (disabled) {
232-
return <Fragment>{children}</Fragment>;
232+
return children;
233233
}
234234

235235
return (
236236
<Profiler id={id} onRender={onRenderCallback}>
237-
<Fragment>{children}</Fragment>
237+
{children}
238238
</Profiler>
239239
);
240240
}

static/app/utils/teams.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {Fragment} from 'react';
2-
31
import {useTeams} from 'sentry/utils/useTeams';
42

53
type RenderProps = ReturnType<typeof useTeams>;
@@ -16,7 +14,7 @@ type Props = Parameters<typeof useTeams>[0] & {
1614
function Teams({children, ...props}: Props) {
1715
const renderProps = useTeams(props);
1816

19-
return <Fragment>{children(renderProps)}</Fragment>;
17+
return children(renderProps);
2018
}
2119

2220
export default Teams;

static/app/views/alerts/rules/metric/onDemandThresholdChecker.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {Fragment} from 'react';
2-
31
import type {Project} from 'sentry/types/project';
42
import {useApiQuery} from 'sentry/utils/queryClient';
53
import useOrganization from 'sentry/utils/useOrganization';
@@ -35,5 +33,5 @@ export function OnDemandThresholdChecker({
3533
const isOnDemandLimitReached =
3634
data === undefined ? undefined : data.totalOnDemandAlertSpecs >= data.maxAllowed;
3735

38-
return <Fragment>{children({isOnDemandLimitReached})}</Fragment>;
36+
return children({isOnDemandLimitReached});
3937
}

static/app/views/dashboards/index.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {Fragment} from 'react';
2-
31
import type {Client} from 'sentry/api';
42
import ErrorBoundary from 'sentry/components/errorBoundary';
53
import NotFound from 'sentry/components/errors/notFound';
@@ -24,7 +22,7 @@ function DashboardsV2Container(props: Props) {
2422
const {organization, children} = props;
2523

2624
if (organization.features.includes('dashboards-edit')) {
27-
return <Fragment>{children}</Fragment>;
25+
return children;
2826
}
2927

3028
return (

static/app/views/insights/agentMonitoring/components/headSortCell.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Fragment, memo} from 'react';
1+
import {memo} from 'react';
22

33
import type {GridColumnHeader} from 'sentry/components/gridEditable';
44
import SortLink from 'sentry/components/gridEditable/sortLink';
@@ -58,7 +58,7 @@ export const HeadSortCell = memo(function HeadCell({
5858
sortField === column.key ? (sortOrder === 'asc' ? 'desc' : 'asc') : 'desc',
5959
},
6060
})}
61-
title={<Fragment>{children}</Fragment>}
61+
title={children}
6262
/>
6363
);
6464
});

static/app/views/insights/crons/components/cronsLandingPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import {Fragment, useEffect} from 'react';
1+
import {useEffect} from 'react';
22
import styled from '@emotion/styled';
33

44
import {Button} from 'sentry/components/core/button';
@@ -128,7 +128,7 @@ export function CronsLandingPanel() {
128128

129129
const OnboardingPanelHook = HookOrDefault({
130130
hookName: 'component:crons-onboarding-panel',
131-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
131+
defaultComponent: ({children}) => children,
132132
});
133133

134134
useEffect(() => {

static/app/views/performance/landing/widgets/components/queryHandler.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export function QueryHandler<T extends WidgetDataConstraint>(
2323
const children = props.children ?? <Fragment />;
2424

2525
if (!props.queries.length) {
26-
return <Fragment>{children}</Fragment>;
26+
return children;
2727
}
2828

2929
return (

static/app/views/replays/list.tsx

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

43
import HookOrDefault from 'sentry/components/hookOrDefault';
@@ -15,7 +14,7 @@ import ReplayTabs from 'sentry/views/replays/tabs';
1514

1615
const ReplayListPageHeaderHook = HookOrDefault({
1716
hookName: 'component:replay-list-page-header',
18-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
17+
defaultComponent: ({children}) => children,
1918
});
2019

2120
function ReplaysListContainer() {

static/app/views/replays/list/replayOnboardingPanel.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ type Breakpoints = {
3636

3737
const OnboardingCTAHook = HookOrDefault({
3838
hookName: 'component:replay-onboarding-cta',
39-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
39+
defaultComponent: ({children}) => children,
4040
});
4141

4242
const OnboardingAlertHook = HookOrDefault({
4343
hookName: 'component:replay-onboarding-alert',
44-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
44+
defaultComponent: ({children}) => children,
4545
});
4646

4747
export default function ReplayOnboardingPanel() {

static/app/views/settings/components/settingsNavItem.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type {ReactElement} from 'react';
2-
import {Fragment} from 'react';
32
import styled from '@emotion/styled';
43

54
import {Badge} from 'sentry/components/core/badge';
@@ -21,7 +20,7 @@ type Props = {
2120

2221
const LabelHook = HookOrDefault({
2322
hookName: 'sidebar:item-label',
24-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
23+
defaultComponent: ({children}) => children,
2524
});
2625

2726
function SettingsNavBadge({badge}: {badge: string | number | null | ReactElement}) {

static/app/views/settings/components/settingsNavItemDeprecated.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type {ReactElement} from 'react';
2-
import {Fragment} from 'react';
32
import {NavLink as RouterNavLink} from 'react-router-dom';
43
import styled from '@emotion/styled';
54
import type {LocationDescriptor} from 'history';
@@ -23,7 +22,7 @@ type Props = {
2322

2423
const LabelHook = HookOrDefault({
2524
hookName: 'sidebar:item-label',
26-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
25+
defaultComponent: ({children}) => children,
2726
});
2827

2928
function SettingsNavItemDeprecated({badge, label, index, id, to, ...props}: Props) {

static/app/views/settings/organizationMembers/organizationMemberDetail.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ const TWO_FACTOR_REQUIRED = t(
5757

5858
const DisabledMemberTooltip = HookOrDefault({
5959
hookName: 'component:disabled-member-tooltip',
60-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
60+
defaultComponent: ({children}) => children,
6161
});
6262

6363
function MemberStatus({

static/app/views/settings/organizationMembers/organizationMemberRow.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ type State = {
3636

3737
const DisabledMemberTooltip = HookOrDefault({
3838
hookName: 'component:disabled-member-tooltip',
39-
defaultComponent: ({children}) => <Fragment>{children}</Fragment>,
39+
defaultComponent: ({children}) => children,
4040
});
4141

4242
export default class OrganizationMemberRow extends PureComponent<Props, State> {

static/gsApp/components/features/planFeature.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import {Fragment} from 'react';
2-
31
import type {Organization} from 'sentry/types/organization';
42
import {descopeFeatureName} from 'sentry/utils';
53

@@ -115,7 +113,7 @@ function PlanFeature({subscription, features, organization, children}: Props) {
115113
? billingConfig.id
116114
: null;
117115

118-
return <Fragment>{children({plan: requiredPlan ?? null, tierChange})}</Fragment>;
116+
return children({plan: requiredPlan ?? null, tierChange});
119117
}
120118

121119
export default withSubscription(PlanFeature, {noLoader: true});

static/gsApp/components/replayOnboardingAlert.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import type {ReactNode} from 'react';
2-
import {Fragment} from 'react';
32

43
import withSubscription from 'getsentry/components/withSubscription';
54
import type {Subscription} from 'getsentry/types';
@@ -17,7 +16,7 @@ function ReplayOnboardingAlert({children, subscription}: Props) {
1716
return null;
1817
}
1918

20-
return <Fragment>{children}</Fragment>;
19+
return children;
2120
}
2221

2322
export default withSubscription(ReplayOnboardingAlert, {noLoader: true});

0 commit comments

Comments
 (0)