Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 'Oh snap' error when creating VPC from Linode Create #10783

Merged
merged 5 commits into from
Aug 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,8 @@ export const VPCPanel = (props: VPCPanelProps) => {
);
}, [vpcs, region, fromLinodeCreate]);

const defaultVPCValue = fromLinodeConfig ? null : vpcDropdownOptions[0];

const subnetDropdownOptions: DropdownOption[] =
vpcs
.find((vpc) => vpc.id === selectedVPCId)
Expand Down Expand Up @@ -198,9 +200,6 @@ export const VPCPanel = (props: VPCPanelProps) => {
<Stack>
<Typography>{getMainCopyVPC()}</Typography>
<Autocomplete
isOptionEqualToValue={(option, value) => {
return option.label === value.label;
}}
onChange={(_, selectedVPC) => {
handleSelectVPC(selectedVPC?.value || -1);
// Track clearing and changing the value once per page view, configured by inputValue in AA backend.
Expand All @@ -227,12 +226,11 @@ export const VPCPanel = (props: VPCPanelProps) => {
selectedVPCId && selectedVPCId !== -1
? vpcDropdownOptions.find(
(option) => option.value === selectedVPCId
)
: null
) ?? null
: defaultVPCValue
}
autoHighlight
clearIcon={null}
defaultValue={fromLinodeConfig ? null : vpcDropdownOptions[0]} // If we're in the Config dialog, there is no "None" option at index 0
disabled={!regionSupportsVPCs}
errorText={vpcIdError ?? vpcError}
label={from === 'linodeCreate' ? 'Assign VPC' : 'VPC'}
Expand Down
Loading