Skip to content

Commit 8da7b6d

Browse files
authored
Require loading prop on SideModalForm, fix snapshot create (#2539)
require loading prop on side modal form, fix snapshot create
1 parent 5edf89e commit 8da7b6d

File tree

7 files changed

+12
-3
lines changed

7 files changed

+12
-3
lines changed

app/components/form/SideModalForm.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,14 @@ type SideModalFormProps<TFieldValues extends FieldValues> = {
4141
resourceName: string
4242
/** Must be provided with a reason describing why it's disabled */
4343
submitDisabled?: string
44+
45+
// require loading and error so we can't forget to hook them up. there are a
46+
// few forms that don't need them, so we'll use dummy values
47+
4448
/** Error from the API call */
4549
submitError: ApiError | null
46-
loading?: boolean
50+
loading: boolean
51+
4752
/** Only needed if you need to override the default title (Create/Edit ${resourceName}) */
4853
title?: string
4954
subtitle?: ReactNode

app/forms/disk-attach.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export function AttachDiskSideModalForm({
3535
onSubmit,
3636
onDismiss,
3737
diskNamesToExclude = [],
38-
loading,
38+
loading = false,
3939
submitError = null,
4040
}: AttachDiskProps) {
4141
const { project } = useProjectSelector()

app/forms/idp/edit.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ export function EditIdpSideModalForm() {
5858
}
5959
// TODO: pass actual error when this form is hooked up
6060
submitError={null}
61+
loading={false}
6162
>
6263
<PropertiesTable>
6364
<PropertiesTable.Row label="ID">

app/forms/image-edit.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ export function EditImageSideModalForm({
8686
}
8787
// TODO: pass actual error when this form is hooked up
8888
submitError={null}
89+
loading={false}
8990
>
9091
<PropertiesTable>
9192
<PropertiesTable.Row label="Shared with">{type}</PropertiesTable.Row>

app/forms/image-from-snapshot.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,7 @@ export function CreateImageFromSnapshotSideModalForm() {
8484
})
8585
}
8686
submitError={createImage.error}
87+
loading={createImage.isPending}
8788
>
8889
<PropertiesTable>
8990
<PropertiesTable.Row label="Snapshot">{data.name}</PropertiesTable.Row>

app/forms/network-interface-create.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ type CreateNetworkInterfaceFormProps = {
4242
export function CreateNetworkInterfaceForm({
4343
onSubmit,
4444
onDismiss,
45-
loading,
45+
loading = false,
4646
submitError = null,
4747
}: CreateNetworkInterfaceFormProps) {
4848
const projectSelector = useProjectSelector()

app/forms/snapshot-create.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ export function CreateSnapshotSideModalForm() {
7272
createSnapshot.mutate({ query: projectSelector, body: values })
7373
}}
7474
submitError={createSnapshot.error}
75+
loading={createSnapshot.isPending}
7576
>
7677
<NameField name="name" control={form.control} />
7778
<DescriptionField name="description" control={form.control} />

0 commit comments

Comments
 (0)