Skip to content

Commit

Permalink
fix: [M3-8196] - Fix Linode Edit Config warning message when initiall…
Browse files Browse the repository at this point in the history
…y selecting a VPC as the primary interface (#11424)

* set initial primaryInterfaceIndex to 0

* extra space oops

* some type cleanup

* Added changeset: Linode Edit Config warning  message when initially selecting a VPC as the primary interface
  • Loading branch information
coliu-akamai authored Dec 17, 2024
1 parent 90761e7 commit d99b334
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
5 changes: 5 additions & 0 deletions packages/manager/.changeset/pr-11424-fixed-1734375315983.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@linode/manager": Fixed
---

Linode Edit Config warning message when initially selecting a VPC as the primary interface ([#11424](https://github.com/linode/manager/pull/11424))
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ export const LinodeConfigDialog = (props: Props) => {
const [
primaryInterfaceIndex,
setPrimaryInterfaceIndex,
] = React.useState<number>();
] = React.useState<number>(0);

const regionHasVLANS = regions.some(
(thisRegion) =>
Expand Down Expand Up @@ -1004,7 +1004,7 @@ export const LinodeConfigDialog = (props: Props) => {
disabled={isReadOnly}
label="Primary Interface (Default Route)"
options={getPrimaryInterfaceOptions(values.interfaces)}
value={primaryInterfaceOptions[primaryInterfaceIndex ?? 0]}
value={primaryInterfaceOptions[primaryInterfaceIndex]}
/>
<Divider
sx={{
Expand Down Expand Up @@ -1242,7 +1242,7 @@ export const unrecommendedConfigNoticeSelector = ({
values,
}: {
_interface: ExtendedInterface;
primaryInterfaceIndex: number | undefined;
primaryInterfaceIndex: number;
thisIndex: number;
values: EditableFields;
}): JSX.Element | null => {
Expand All @@ -1255,9 +1255,7 @@ export const unrecommendedConfigNoticeSelector = ({

// Edge case: users w/ ability to have multiple VPC interfaces. Scenario 1 & 2 notices not helpful if that's done
const primaryInterfaceIsVPC =
primaryInterfaceIndex !== undefined
? values.interfaces[primaryInterfaceIndex].purpose === 'vpc'
: false;
values.interfaces[primaryInterfaceIndex].purpose === 'vpc';

/*
Scenario 1:
Expand Down

0 comments on commit d99b334

Please sign in to comment.