diff --git a/app/pages/project/instances/instance/InstancePage.tsx b/app/pages/project/instances/instance/InstancePage.tsx index 376635558..777d8db20 100644 --- a/app/pages/project/instances/instance/InstancePage.tsx +++ b/app/pages/project/instances/instance/InstancePage.tsx @@ -6,7 +6,7 @@ * Copyright Oxide Computer Company */ import { filesize } from 'filesize' -import { useMemo, useState } from 'react' +import { useId, useMemo, useState } from 'react' import { useForm } from 'react-hook-form' import { Link, useNavigate, type LoaderFunctionArgs } from 'react-router-dom' @@ -314,13 +314,14 @@ export function ResizeInstanceModal({ form.watch('ncpus') !== instance.ncpus || form.watch('memory') !== instance.memory / GiB const isDisabled = !form.formState.isValid || !canResize || !willChange - const onAction = form.handleSubmit(({ ncpus, memory }) => { + const onSubmit = form.handleSubmit(({ ncpus, memory }) => { instanceUpdate.mutate({ path: { instance: instance.name }, query: { project }, body: { ncpus, memory: memory * GiB, bootDisk: instance.bootDiskId }, }) }) + const formId = useId() return ( @@ -340,7 +341,7 @@ export function ResizeInstanceModal({ } /> )} -
+ void + actionType?: 'primary' | 'danger' + actionText: React.ReactNode + actionLoading?: boolean + cancelText?: string + disabled?: boolean +} & MergeExclusive<{ formId: string }, { onAction: () => void }> + Modal.Footer = ({ children, onDismiss, @@ -134,16 +150,8 @@ Modal.Footer = ({ actionLoading, cancelText, disabled = false, -}: { - children?: React.ReactNode - onDismiss: () => void - onAction: () => void - actionType?: 'primary' | 'danger' - actionText: React.ReactNode - actionLoading?: boolean - cancelText?: string - disabled?: boolean -}) => ( + formId, +}: FooterProps) => (