Skip to content

Commit 0d05f27

Browse files
jaalah-akamaijaalahmjac0bs
authored
fix: [M3-10435] - ImageSelect, UserData Bug Fixes (#12638)
* fix: [M3-10435] - ImageSelect, UserData Bug Fixes * Added changeset: Fix ImageSelect onChange rendering bug as well as other console errors * Update packages/manager/src/features/Linodes/LinodeCreate/UserData/UserDataHeading.tsx Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com> --------- Co-authored-by: Jaalah Ramos <jaalah.ramos@gmail.com> Co-authored-by: Mariah Jacobs <114685994+mjac0bs@users.noreply.github.com>
1 parent 6d4ef56 commit 0d05f27

File tree

7 files changed

+34
-39
lines changed

7 files changed

+34
-39
lines changed
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@linode/manager": Fixed
3+
---
4+
5+
Fix ImageSelect onChange rendering bug as well as other console errors ([#12638](https://github.com/linode/manager/pull/12638))

packages/manager/src/components/Flag.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ const getFlagClass = (country: Country | string) => {
4646
};
4747

4848
const StyledFlag = styled(Box, {
49-
shouldForwardProp: omittedProps(['hasBorder']),
5049
label: 'StyledFlag',
50+
shouldForwardProp: omittedProps(['hasBorder']),
5151
})<{
5252
hasBorder: boolean;
5353
}>(({ theme, hasBorder }) => ({

packages/manager/src/components/ImageSelect/ImageSelect.tsx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,16 @@ export const ImageSelect = (props: Props) => {
152152
return isImageDeprecated(value) && [value];
153153
}, [value]);
154154

155-
if (options.length === 1 && onChange && selectIfOnlyOneOption && !multiple) {
156-
onChange(options[0]);
157-
}
155+
React.useEffect(() => {
156+
if (
157+
options.length === 1 &&
158+
onChange &&
159+
selectIfOnlyOneOption &&
160+
!multiple
161+
) {
162+
onChange(options[0]);
163+
}
164+
}, [options.length, onChange, selectIfOnlyOneOption, multiple, options]);
158165

159166
return (
160167
<Box sx={{ width: '100%' }}>

packages/manager/src/factories/cloudpulse/services.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,7 @@
11
import { type Service } from '@linode/api-v4';
22
import { Factory } from '@linode/utilities';
33

4-
import type {
5-
CloudPulseServiceType,
6-
7-
ServiceAlert,
8-
} from '@linode/api-v4';
4+
import type { CloudPulseServiceType, ServiceAlert } from '@linode/api-v4';
95

106
const serviceTypes: CloudPulseServiceType[] = [
117
'linode',

packages/manager/src/features/Kubernetes/KubernetesClusterDetail/KubernetesClusterDetail.tsx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,9 @@ import UpgradeKubernetesVersionBanner from './UpgradeKubernetesVersionBanner';
2626

2727
export const KubernetesClusterDetail = () => {
2828
const { data: account } = useAccount();
29-
const { clusterId: id } = useParams({ from: '/kubernetes/clusters/$clusterId' });
29+
const { clusterId: id } = useParams({
30+
from: '/kubernetes/clusters/$clusterId',
31+
});
3032
const location = useLocation();
3133
const { showAPL } = useAPLAvailability();
3234
const { isUsingBetaEndpoint } = useKubernetesBetaEndpoint();

packages/manager/src/features/Linodes/LinodeCreate/UserData/UserData.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { useImageQuery, useRegionsQuery } from '@linode/queries';
2-
import { Accordion, Notice, TextField, Typography } from '@linode/ui';
2+
import { Accordion, Notice, TextField } from '@linode/ui';
33
import React, { useMemo } from 'react';
44
import { Controller, useFormContext, useWatch } from 'react-hook-form';
55

6-
import { Link } from 'src/components/Link';
76
import { usePermissions } from 'src/features/IAM/hooks/usePermissions';
87

98
import { UserDataHeading } from './UserDataHeading';
@@ -55,17 +54,6 @@ export const UserData = () => {
5554

5655
return (
5756
<Accordion heading={<UserDataHeading />} sx={{ m: '0 !important', p: 1 }}>
58-
<Typography>
59-
User data is a feature of the Metadata service that enables you to
60-
perform system configuration tasks (such as adding users and installing
61-
software) by providing custom instructions or scripts to cloud-init. Any
62-
user data should be added at this step and cannot be modified after the
63-
the Linode has been created.{' '}
64-
<Link to="https://techdocs.akamai.com/cloud-computing/docs/overview-of-the-metadata-service">
65-
Learn more
66-
</Link>
67-
.
68-
</Typography>
6957
{formatWarning && (
7058
<Notice spacingBottom={16} spacingTop={16} variant="warning">
7159
The user data may be formatted incorrectly.

packages/manager/src/features/Linodes/LinodeCreate/UserData/UserDataHeading.tsx

Lines changed: 13 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Notice, Stack, TooltipIcon, Typography } from '@linode/ui';
1+
import { Notice, Stack, Typography } from '@linode/ui';
22
import React from 'react';
33

44
import { Link } from 'src/components/Link';
@@ -25,22 +25,19 @@ export const UserDataHeading = () => {
2525

2626
return (
2727
<Stack spacing={1}>
28-
<Stack direction="row" spacing={1}>
28+
<Stack direction="column" spacing={1}>
2929
<Typography variant="h2">Add User Data</Typography>
30-
<TooltipIcon
31-
status="info"
32-
sxTooltipIcon={{ p: 0 }}
33-
text={
34-
<>
35-
User data allows you to provide additional custom data to
36-
cloud-init to further configure your system.{' '}
37-
<Link to="https://techdocs.akamai.com/cloud-computing/docs/overview-of-the-metadata-service">
38-
Learn more
39-
</Link>
40-
.
41-
</>
42-
}
43-
/>
30+
<Typography>
31+
User data is a feature of the Metadata service that enables you to
32+
perform system configuration tasks (such as adding users and
33+
installing software) by providing custom instructions or scripts to
34+
cloud-init. Any user data should be added at this step and cannot be
35+
modified after the the Linode has been created.{' '}
36+
<Link to="https://techdocs.akamai.com/cloud-computing/docs/overview-of-the-metadata-service">
37+
Learn more
38+
</Link>
39+
.
40+
</Typography>
4441
</Stack>
4542
{warningMessage && (
4643
<Notice spacingBottom={0} spacingTop={0} variant="warning">

0 commit comments

Comments
 (0)