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

Commit 870b4d5

Browse files
committed
fix(roles): NaN rate values in the RoleForm
* Fix a bug with the `IntegerField` controls of the `RoleForm`, that was occurring when user trying to increase/decrease a number field which initially has `null`. * This was causing `NaN` values in the field. * This fix starts `IntegerField` controls with `0`, in case the user is trying to increase/decrease a `null` field. Addresses https://github.com/topcoder-platform/taas-app/issues/421
1 parent 6c79c7a commit 870b4d5

File tree

1 file changed

+8
-0
lines changed
  • src/routes/Roles/components/RoleForm

1 file changed

+8
-0
lines changed

src/routes/Roles/components/RoleForm/index.jsx

+8
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,14 @@ function RoleForm() {
8989

9090
const editRate = useCallback(
9191
(index, changes) => {
92+
// a num field is `null` but user trying to increase/decrease it
93+
// start with 0
94+
for (const key in changes) {
95+
if (isNaN(changes[key])) {
96+
changes[key] = 0;
97+
}
98+
}
99+
// apply changes
92100
dispatch(
93101
setModalRole({
94102
...roleState,

0 commit comments

Comments
 (0)