Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit b11eb0d

Browse files
committed
fix(roles): reset modalError when re-opened
* The `modalError` of the previous operation was still being displayed even after closing & opening the modal again. * This fix resets the `modalError` each time it re-opened. Addresses https://github.com/topcoder-platform/taas-app/issues/423
1 parent a58e35c commit b11eb0d

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/routes/Roles/index.jsx

+9-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ import { useDispatch, useSelector } from "react-redux";
33
import debounce from "lodash/debounce";
44
import omit from "lodash/omit";
55
import withAuthentication from "hoc/withAuthentication";
6-
import { setFilter, setIsModalOpen, setModalRole } from "store/actions/roles";
6+
import {
7+
setFilter,
8+
setIsModalOpen,
9+
setModalError,
10+
setModalRole,
11+
} from "store/actions/roles";
712
import { createRole, deleteRole, updateRole } from "store/thunks/roles";
813
import {
914
getRolesIsModalOpen,
@@ -48,6 +53,7 @@ const Roles = () => {
4853

4954
const onCreateClick = useCallback(() => {
5055
setModalOperationType("CREATE");
56+
dispatch(setModalError(null));
5157
// role template with initial values
5258
dispatch(
5359
setModalRole({
@@ -65,6 +71,7 @@ const Roles = () => {
6571
const onEditClick = useCallback(
6672
(role) => {
6773
setModalOperationType("EDIT");
74+
dispatch(setModalError(null));
6875
dispatch(setModalRole(role));
6976
dispatch(setIsModalOpen(true));
7077
},
@@ -74,6 +81,7 @@ const Roles = () => {
7481
const onDeleteClick = useCallback(
7582
(role) => {
7683
setModalOperationType("DELETE");
84+
dispatch(setModalError(null));
7785
dispatch(setModalRole(role));
7886
dispatch(setIsModalOpen(true));
7987
},

0 commit comments

Comments
 (0)