diff --git a/app/components/form/SideModalForm.tsx b/app/components/form/SideModalForm.tsx index 8367a4d98..5cb729c37 100644 --- a/app/components/form/SideModalForm.tsx +++ b/app/components/form/SideModalForm.tsx @@ -41,9 +41,14 @@ type SideModalFormProps = { resourceName: string /** Must be provided with a reason describing why it's disabled */ submitDisabled?: string + + // require loading and error so we can't forget to hook them up. there are a + // few forms that don't need them, so we'll use dummy values + /** Error from the API call */ submitError: ApiError | null - loading?: boolean + loading: boolean + /** Only needed if you need to override the default title (Create/Edit ${resourceName}) */ title?: string subtitle?: ReactNode diff --git a/app/forms/disk-attach.tsx b/app/forms/disk-attach.tsx index ccfccdc7f..5a6eeaaaf 100644 --- a/app/forms/disk-attach.tsx +++ b/app/forms/disk-attach.tsx @@ -35,7 +35,7 @@ export function AttachDiskSideModalForm({ onSubmit, onDismiss, diskNamesToExclude = [], - loading, + loading = false, submitError = null, }: AttachDiskProps) { const { project } = useProjectSelector() diff --git a/app/forms/idp/edit.tsx b/app/forms/idp/edit.tsx index 966aace09..2adc777b0 100644 --- a/app/forms/idp/edit.tsx +++ b/app/forms/idp/edit.tsx @@ -58,6 +58,7 @@ export function EditIdpSideModalForm() { } // TODO: pass actual error when this form is hooked up submitError={null} + loading={false} > diff --git a/app/forms/image-edit.tsx b/app/forms/image-edit.tsx index 9b3ccf0d3..11d1c7929 100644 --- a/app/forms/image-edit.tsx +++ b/app/forms/image-edit.tsx @@ -86,6 +86,7 @@ export function EditImageSideModalForm({ } // TODO: pass actual error when this form is hooked up submitError={null} + loading={false} > {type} diff --git a/app/forms/image-from-snapshot.tsx b/app/forms/image-from-snapshot.tsx index c6a9ac1e2..8d44a1d8e 100644 --- a/app/forms/image-from-snapshot.tsx +++ b/app/forms/image-from-snapshot.tsx @@ -84,6 +84,7 @@ export function CreateImageFromSnapshotSideModalForm() { }) } submitError={createImage.error} + loading={createImage.isPending} > {data.name} diff --git a/app/forms/network-interface-create.tsx b/app/forms/network-interface-create.tsx index e224016a8..fb4d6d6b4 100644 --- a/app/forms/network-interface-create.tsx +++ b/app/forms/network-interface-create.tsx @@ -42,7 +42,7 @@ type CreateNetworkInterfaceFormProps = { export function CreateNetworkInterfaceForm({ onSubmit, onDismiss, - loading, + loading = false, submitError = null, }: CreateNetworkInterfaceFormProps) { const projectSelector = useProjectSelector() diff --git a/app/forms/snapshot-create.tsx b/app/forms/snapshot-create.tsx index 25c7f90db..3ad4c448f 100644 --- a/app/forms/snapshot-create.tsx +++ b/app/forms/snapshot-create.tsx @@ -72,6 +72,7 @@ export function CreateSnapshotSideModalForm() { createSnapshot.mutate({ query: projectSelector, body: values }) }} submitError={createSnapshot.error} + loading={createSnapshot.isPending} >