Skip to content

Commit c624258

Browse files
committed
Merge branch 'master' into feature/react-testing-library
2 parents e4b0a87 + 424f400 commit c624258

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/components/UserForm/index.jsx

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,11 @@ import ErrorMessage from '../ErrorMessage';
1616

1717
import './UserForm.scss';
1818

19-
const UserForm = ({ isEditing, isProfile, user, action }) => {
20-
const { loading } = useSelector(
19+
const UserForm = ({ isEditing, isProfile, user, setUser, action }) => {
20+
const { loading, success } = useSelector(
2121
(state) => ({
2222
loading: state.users.loading,
23+
success: state.users.success,
2324
}),
2425
shallowEqual
2526
);
@@ -42,8 +43,11 @@ const UserForm = ({ isEditing, isProfile, user, action }) => {
4243
});
4344

4445
useEffect(() => {
46+
if (success) {
47+
setUser((prevState) => ({ ...prevState, file: null }));
48+
}
4549
return () => dispatch(usersCleanUp());
46-
}, [dispatch]);
50+
}, [dispatch, success]);
4751

4852
const onSubmitHandler = (value) => {
4953
const newUser = {
@@ -252,7 +256,7 @@ const UserForm = ({ isEditing, isProfile, user, action }) => {
252256
/>
253257
<span className="file-cta">
254258
<span className="file-icon">
255-
<i className="fas fa-upload" />
259+
<i className="mdi mdi-upload" />
256260
</span>
257261
<span className="file-label">
258262
{watch('file') && watch('file').file

0 commit comments

Comments
 (0)