File tree 1 file changed +4
-3
lines changed
src/components/ProjectForm
1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ const ProjectForm = ({
22
22
register,
23
23
handleSubmit,
24
24
control,
25
- formState : { errors }
25
+ reset,
26
+ formState : { isDirty, errors }
26
27
} = useForm ( {
27
28
defaultValues : {
28
29
projectName : isEdit ? projectDetail . name : '' ,
@@ -65,6 +66,7 @@ const ProjectForm = ({
65
66
console . error ( err )
66
67
} finally {
67
68
setIsSaving ( false )
69
+ reset ( data )
68
70
}
69
71
}
70
72
@@ -155,7 +157,6 @@ const ProjectForm = ({
155
157
options = { projectTypeOptions }
156
158
id = 'projectType'
157
159
{ ...field }
158
- isClearable
159
160
placeholder = 'Select Project Type'
160
161
/>
161
162
) }
@@ -238,7 +239,7 @@ const ProjectForm = ({
238
239
text = { isSaving ? 'Saving...' : 'Save' }
239
240
type = { 'info' }
240
241
submit
241
- disabled = { isSaving }
242
+ disabled = { isSaving || ! isDirty }
242
243
/>
243
244
</ div >
244
245
</ form >
You can’t perform that action at this time.
0 commit comments