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 2 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 @@ -227,7 +227,7 @@ export const VPCPanel = (props: VPCPanelProps) => {
selectedVPCId && selectedVPCId !== -1
? vpcDropdownOptions.find(
(option) => option.value === selectedVPCId
)
) || null
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally, I'd changed line 202 to be return option.label === value?.label;, since the bug is caused by the value being undefined. I thought that would be a super quick fix πŸ˜… but this led to two MUI errors:

  • controlled changing to uncontrolled input error
  • "The value provided to Autocomplete is invalid. None of the options match with undefined."

ngl it took me a hot second to remember that array.find can return an undefined value oops πŸ˜… so this change ensures that the item being passed to the value prop is always 'null' or some vpc dropdown option, not undefined. This fixes both the original problem and gets rid of the two MUI warnings above too!

This originally slipped past likely because the value prop is an optional parameter, so it can technically still be undefined (but we won't be passing it an undefined value).

image
image

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I've also been trying to play around with making it look cleaner so if anyone has suggestions lmk πŸ˜†)

coliu-akamai marked this conversation as resolved.
Show resolved Hide resolved
: null
}
autoHighlight
Expand Down
Loading