Update instance-create to handle both v4 and v6 ephemeral IP options#3057
Open
charliepark wants to merge 18 commits intomainfrom
Open
Update instance-create to handle both v4 and v6 ephemeral IP options#3057charliepark wants to merge 18 commits intomainfrom
charliepark wants to merge 18 commits intomainfrom
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
c1fc16d to
fc14295
Compare
Collaborator
app/forms/instance-create.tsx
Outdated
| () => unicastPools.filter(poolHasIpVersion(compatibleVersions)), | ||
| [unicastPools, compatibleVersions] | ||
| ) | ||
| .filter((ip): ip is FloatingIp => !!ip) |
Collaborator
There was a problem hiding this comment.
Type guard shouldn't be necessary as far as I know — is it?
Contributor
Author
There was a problem hiding this comment.
The flow to end up in a state where it's actually useful is pretty rare …
- User selects "ip-1" from modal → added to attachedFloatingIps (form state)
- React Query refetches floatingIpList (on window focus, reconnect, or stale time expiry)
- "ip-1" is now attached to another instance or deleted (via some other user on the system)
- "ip-1" filtered out of attachableFloatingIps
- Form state still has "ip-1", but .find() can't find it
But TS complains* unless it has either a filter (.filter((ip) => ip !== undefined) or .filter((ip) => !!ip)), or an ! assertion (floatingIp) => attachableFloatingIps.find((fip) => fip.name === floatingIp)!
- The complaint is in the MiniTable, where an
itemmight be undefined.
I'm moving to an assertion as that should throw an error if the user ends up in that state, versus having the Floating IP silently disappear, but I'm open to filtering if that feels like a better situation.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Instances can now have both IPv4- and IPv6-backed ephemeral IPs. This updates the instance create flow to account for that.
It checks / unchecks the ephemeral IP box for the IP version(s) specified in the Network Interfaces section of the form.
Default NICs



Custom NICs



No NIC

Closes #3041