Skip to content

Commit 2159753

Browse files
[LoadingIndicator]: Replace defaultProps with destructuring (#2601)
## Which problem is this PR solving? - Part of #2596 ## Description of the changes - Updated the LoadingIndicator component to remove defaultProps so as to avoid the deprecation warnings. - Updated the snapshots so as to match the new LoadingIndicator. ## How was this change tested? - Running `npm ci` `npm run update-snapshots` and `npm test` passes all the tests - Tested manually by rendering LoadingIndicator using various props ## Checklist - [x] I have read https://github.com/jaegertracing/jaeger/blob/master/CONTRIBUTING_GUIDELINES.md - [x] I have signed all commits - [x] I have added unit tests for the new functionality - [ ] I have run lint and test steps successfully - for `jaeger`: `make lint test` - for `jaeger-ui`: `npm run lint` and `npm run test` --------- Signed-off-by: Abhishek <[email protected]> Signed-off-by: Yuri Shkuro <[email protected]> Co-authored-by: Yuri Shkuro <[email protected]>
1 parent 7104ef3 commit 2159753

File tree

5 files changed

+12
-21
lines changed

5 files changed

+12
-21
lines changed

packages/jaeger-ui/src/components/DeepDependencies/SidePanel/__snapshots__/DetailsPanel.test.js.snap

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,7 @@ exports[`<SidePanel> render renders detailLink 1`] = `
8989
className="Ddg--DetailsPanel--LoadingWrapper"
9090
>
9191
<LoadingIndicator
92-
centered={false}
9392
className="Ddg--DetailsPanel--LoadingIndicator"
94-
small={false}
9593
/>
9694
</div>
9795
<VerticalResizer
@@ -268,9 +266,7 @@ exports[`<SidePanel> render renders while loading 1`] = `
268266
className="Ddg--DetailsPanel--LoadingWrapper"
269267
>
270268
<LoadingIndicator
271-
centered={false}
272269
className="Ddg--DetailsPanel--LoadingIndicator"
273-
small={false}
274270
/>
275271
</div>
276272
<VerticalResizer

packages/jaeger-ui/src/components/Monitor/ServicesView/__snapshots__/serviceGraph.test.js.snap

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,6 @@ exports[`<ServiceGraph> Loading indicator is displayed 1`] = `
704704
>
705705
<LoadingIndicator
706706
centered={true}
707-
small={false}
708707
/>
709708
</div>
710709
</div>
@@ -735,7 +734,6 @@ exports[`<ServiceGraph> Loading indicator is displayed when xDomain is empty 1`]
735734
>
736735
<LoadingIndicator
737736
centered={true}
738-
small={false}
739737
/>
740738
</div>
741739
</div>

packages/jaeger-ui/src/components/Monitor/ServicesView/operationDetailsTable/__snapshots__/index.test.js.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ exports[`<OperationTableDetails> "Couldn’t fetch data" displayed 1`] = `
1111
exports[`<OperationTableDetails> Loading indicator is displayed 1`] = `
1212
<LoadingIndicator
1313
centered={true}
14-
small={false}
1514
/>
1615
`;
1716

packages/jaeger-ui/src/components/QualityMetrics/__snapshots__/index.test.js.snap

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ exports[`QualityMetrics UnconnectedQualityMetrics render renders when loading 1`
4444
/>
4545
<LoadingIndicator
4646
centered={true}
47-
small={false}
4847
/>
4948
</div>
5049
`;

packages/jaeger-ui/src/components/common/LoadingIndicator.tsx

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,28 +17,27 @@ import { LuLoader2 } from 'react-icons/lu';
1717

1818
import './LoadingIndicator.css';
1919

20-
type LoadingIndicatorProps = {
20+
export default function LoadingIndicator({
21+
centered = false,
22+
vcentered,
23+
className = '',
24+
small = false,
25+
style,
26+
...rest
27+
}: {
2128
centered?: boolean;
2229
vcentered?: boolean;
2330
className?: string;
2431
small?: boolean;
2532
style?: React.CSSProperties;
26-
};
27-
28-
export default function LoadingIndicator(props: LoadingIndicatorProps) {
29-
const { centered, vcentered, className, small, ...rest } = props;
33+
}) {
3034
const cls = `
3135
LoadingIndicator
3236
${centered ? 'is-centered' : ''}
3337
${vcentered ? 'is-vcentered' : ''}
3438
${small ? 'is-small' : ''}
35-
${className || ''}
39+
${className}
3640
`;
37-
return <LuLoader2 className={cls} {...rest} />;
38-
}
3941

40-
LoadingIndicator.defaultProps = {
41-
centered: false,
42-
className: undefined,
43-
small: false,
44-
};
42+
return <LuLoader2 className={cls} {...rest} style={style} />;
43+
}

0 commit comments

Comments
 (0)