@@ -10,7 +10,7 @@ import { getGetInstancesQueryKey, useCreateInstance } from "@squonk/data-manager
10
10
import { useGetJob } from "@squonk/data-manager-client/job" ;
11
11
12
12
import { Box , Grid , TextField , Typography } from "@mui/material" ;
13
- import Form from "@rjsf/mui " ;
13
+ import type { FormProps } from "@rjsf/core " ;
14
14
import validator from "@rjsf/validator-ajv8" ;
15
15
import { useQueryClient } from "@tanstack/react-query" ;
16
16
import dynamic from "next/dynamic" ;
@@ -28,6 +28,11 @@ const JobInputFields = dynamic<JobInputFieldsProps>(
28
28
{ loading : ( ) => < CenterLoader /> } ,
29
29
) ;
30
30
31
+ // this dynamic import is necessary to avoid hydration issues with the form
32
+ const Form = dynamic < FormProps > ( ( ) => import ( "@rjsf/mui" ) . then ( ( mod ) => mod . Form ) , {
33
+ loading : ( ) => < CenterLoader /> ,
34
+ } ) ;
35
+
31
36
export type InputData = Record < string , string | string [ ] | undefined > ;
32
37
33
38
interface JobSpecification {
@@ -161,14 +166,15 @@ export const JobModal = ({
161
166
}
162
167
} ;
163
168
169
+ const validateForm = formRef . current ?. validateForm ;
170
+
164
171
return (
165
172
< ModalWrapper
166
173
DialogProps = { { maxWidth : "md" , fullWidth : true } }
167
174
id = { `job-${ jobId } ` }
168
175
open = { open }
169
176
submitDisabled = {
170
- ( formRef . current ?. validateForm ( ) !== undefined && ! formRef . current ?. validateForm ( ) ) ||
171
- ! inputsValid
177
+ ( validateForm && validateForm ( ) !== undefined && validateForm ( ) ) || ! inputsValid
172
178
}
173
179
submitText = "Run"
174
180
title = { job ?. name ?? "Run Job" }
0 commit comments