Skip to content

Commit 6c97d4a

Browse files
fix: UIE-9998 - Reset Private IP value on switching between linode interface and config profile interface in Create linode form
1 parent 0ac4756 commit 6c97d4a

File tree

3 files changed

+13
-15
lines changed

3 files changed

+13
-15
lines changed

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

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,15 @@
11
import { useRegionsQuery } from '@linode/queries';
22
import { Divider, Notice, Paper, Stack, Typography } from '@linode/ui';
33
import React, { useMemo } from 'react';
4-
import { useWatch } from 'react-hook-form';
4+
import { useFormContext, useWatch } from 'react-hook-form';
55

66
import { Backups } from './Backups';
77
import { PrivateIP } from './PrivateIP';
88

99
import type { CreateLinodeRequest } from '@linode/api-v4';
1010

1111
export const Addons = () => {
12+
const { setValue } = useFormContext<CreateLinodeRequest>();
1213
const [regionId, interfaceGeneration] = useWatch<
1314
CreateLinodeRequest,
1415
['region', 'interface_generation']
@@ -26,6 +27,11 @@ export const Addons = () => {
2627

2728
const shouldShowPrivateIP = interfaceGeneration !== 'linode';
2829

30+
// Clean up private IP value when the option is hidden
31+
if (!shouldShowPrivateIP) {
32+
setValue('private_ip', false);
33+
}
34+
2935
return (
3036
<Paper data-qa-add-ons>
3137
<Stack spacing={2}>

packages/manager/src/features/Linodes/LinodeCreate/Addons/PrivateIP.tsx

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import { useRegionsQuery } from '@linode/queries';
22
import {
33
Checkbox,
44
FormControlLabel,
5-
NewFeatureChip,
65
Notice,
76
Stack,
87
Typography,
@@ -59,15 +58,12 @@ export const PrivateIP = () => {
5958
Lets you connect with other Linodes in the same region over the data
6059
center&apos;s private network, without using a public IPv4 address.
6160
</Typography>
62-
<Notice variant="tip">
63-
<Stack alignItems="center" direction="row" spacing={1}>
64-
<NewFeatureChip />
65-
<Typography>
66-
You can now establish network isolation and connections to
67-
NodeBalancer backends through VPC. We recommend using VPC
68-
instead of Private IPs.
69-
</Typography>
70-
</Stack>
61+
<Notice marginTop="12px !important" variant="tip">
62+
<Typography>
63+
You can now establish network isolation and connections to
64+
NodeBalancer backends through VPC. We recommend using VPC instead
65+
of Private IPs.
66+
</Typography>
7167
</Notice>
7268
</Stack>
7369
}

packages/manager/src/features/Linodes/LinodeCreate/Networking/InterfaceType.test.tsx

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,6 @@ const defaultFormValues: Partial<LinodeCreateFormValues> = {
2222
};
2323

2424
describe('InterfaceType', () => {
25-
beforeEach(() => {
26-
vi.clearAllMocks();
27-
});
28-
2925
it('renders all interface type options', () => {
3026
const { getByText, getByRole } = renderWithThemeAndHookFormContext({
3127
component: <InterfaceType index={0} />,

0 commit comments

Comments
 (0)