Skip to content

Commit

Permalink
Implemented scenario of deleting institution
Browse files Browse the repository at this point in the history
- Got bug with rerendering of RecordForm after these changes 22a67fe
  • Loading branch information
skorphil committed Feb 26, 2024
1 parent 22a67fe commit 0b2ca7f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion components/InstitutionContainer/InstitutionContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,10 @@ const AssetsList = ({ isInstitutionOpen, institutionName }) => {
} = useFieldArray({
name: arrayName,
});
const { resetField } = useFormContext();
const {
resetField,
handlers: { handleInstitutionDelete },
} = useFormContext();

return (
<VStack
Expand Down
4 changes: 2 additions & 2 deletions components/RecordForm/RecordForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ export function RecordForm({ onSubmit }) {
handleInstitutionDelete: (indexToDelete) =>
handleInstitution.delete({
indexToDelete,
formValues: getValues(arrayName),
formValues: form.getValues(arrayName),
setSelectedInstitutionIndex,
setIsInstitutionOpen,
formSetValue: setValue,
formSetValue: form.setValue,
}),
},
};
Expand Down

0 comments on commit 0b2ca7f

Please sign in to comment.