Skip to content

Commit

Permalink
small simplification to reduce changes in PR
Browse files Browse the repository at this point in the history
  • Loading branch information
charliepark committed Dec 18, 2024
1 parent 5c2ff28 commit 311e67d
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions app/forms/floating-ip-edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,11 @@ export function EditFloatingIpSideModalForm() {
path: { floatingIp: floatingIpSelector.floatingIp },
query: { project: floatingIpSelector.project },
})
const { name, description, ip, ipPoolId, instanceId } = floatingIp

const { data: instances } = usePrefetchedQuery(
instanceList(floatingIpSelector.project).optionsFn()
)
const instanceName = instances.items.find((i) => i.id === instanceId)?.name
const instanceName = instances.items.find((i) => i.id === floatingIp.instanceId)?.name

const editFloatingIp = useApiMutation('floatingIpUpdate', {
onSuccess(_floatingIp) {
Expand All @@ -71,7 +70,7 @@ export function EditFloatingIpSideModalForm() {
},
})

const form = useForm({ defaultValues: { name, description } })
const form = useForm({ defaultValues: floatingIp })
return (
<SideModalForm
form={form}
Expand All @@ -90,10 +89,10 @@ export function EditFloatingIpSideModalForm() {
>
<PropertiesTable>
<PropertiesTable.Row label="IP Address">
<CopyableIp ip={ip} isLinked={false} />
<CopyableIp ip={floatingIp.ip} isLinked={false} />
</PropertiesTable.Row>
<PropertiesTable.Row label="IP Pool">
<IpPoolCell ipPoolId={ipPoolId} />
<IpPoolCell ipPoolId={floatingIp.ipPoolId} />
</PropertiesTable.Row>
<PropertiesTable.Row label="Instance">
{instanceName ? (
Expand Down

0 comments on commit 311e67d

Please sign in to comment.