File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
src/components/ProjectForm Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -22,7 +22,8 @@ const ProjectForm = ({
2222 register,
2323 handleSubmit,
2424 control,
25- formState : { errors }
25+ reset,
26+ formState : { isDirty, errors }
2627 } = useForm ( {
2728 defaultValues : {
2829 projectName : isEdit ? projectDetail . name : '' ,
@@ -65,6 +66,7 @@ const ProjectForm = ({
6566 console . error ( err )
6667 } finally {
6768 setIsSaving ( false )
69+ reset ( data )
6870 }
6971 }
7072
@@ -155,7 +157,6 @@ const ProjectForm = ({
155157 options = { projectTypeOptions }
156158 id = 'projectType'
157159 { ...field }
158- isClearable
159160 placeholder = 'Select Project Type'
160161 />
161162 ) }
@@ -238,7 +239,7 @@ const ProjectForm = ({
238239 text = { isSaving ? 'Saving...' : 'Save' }
239240 type = { 'info' }
240241 submit
241- disabled = { isSaving }
242+ disabled = { isSaving || ! isDirty }
242243 />
243244 </ div >
244245 </ form >
You can’t perform that action at this time.
0 commit comments