Skip to content

Commit

Permalink
fix: ensure form resets with default values on animation end
Browse files Browse the repository at this point in the history
  • Loading branch information
chertik77 committed Dec 25, 2024
1 parent 3c41a9c commit 49198cd
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export const EditBoardModal = () => {
return (
<Modal
modalTitle='Edit board'
onAnimationEnd={reset}>
onAnimationEnd={() => reset({}, { keepDefaultValues: true })}>
<form onSubmit={handleSubmit(data => mutate(data))}>
<Field
{...register('title', { setValueAs: value => value.trim() })}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export const EditCardModal = () => {
return (
<Modal
modalTitle='Edit card'
onAnimationEnd={reset}>
onAnimationEnd={() => reset({}, { keepDefaultValues: true })}>
<form
onSubmit={handleSubmit(data => mutate({ cardId: id, cardData: data }))}>
<Field
Expand Down
2 changes: 1 addition & 1 deletion src/features/user/components/modals/EditProfileModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export const EditProfileModal = () => {
return (
<Modal
modalTitle='Edit profile'
onAnimationEnd={reset}>
onAnimationEnd={() => reset({}, { keepDefaultValues: true })}>
<form onSubmit={handleSubmit(data => mutate(data))}>
<EditAvatar changeUserAvatar={mutateAsync} />
<Field
Expand Down

0 comments on commit 49198cd

Please sign in to comment.