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

Commit 99d5b57

Browse files
committed
fix(create-new-team): initialValue of MonthPicker on EditRoleForm
Addresses #415
1 parent daeeb06 commit 99d5b57

File tree

1 file changed

+5
-4
lines changed
  • src/routes/CreateNewTeam/components/EditRoleForm

1 file changed

+5
-4
lines changed

src/routes/CreateNewTeam/components/EditRoleForm/index.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ const Error = ({ name }) => {
3030
};
3131

3232
function EditRoleForm({ onChange, role }) {
33-
const [startMonthVisible, setStartMonthVisible] = useState(false);
3433
const onRoleChange = (state) => {
3534
if (state.hasValidationErrors) {
3635
onChange(false);
@@ -121,9 +120,9 @@ function EditRoleForm({ onChange, role }) {
121120
<Error name="durationWeeks" />
122121
</td>
123122
<td>
124-
{startMonthVisible ? (
123+
{role.startMonth ? (
125124
<>
126-
<Field name="startMonth" initialValue={Date.now()}>
125+
<Field name="startMonth" initialValue={role.startMonth}>
127126
{(props) => (
128127
<MonthPicker
129128
name={props.input.name}
@@ -143,7 +142,9 @@ function EditRoleForm({ onChange, role }) {
143142
<div styleName="flex-container">
144143
<button
145144
styleName="toggle-button"
146-
onClick={() => setStartMonthVisible(true)}
145+
onClick={() =>
146+
onRoleChange({ values: { startMonth: Date.now() } })
147+
}
147148
>
148149
Add Start Month
149150
</button>

0 commit comments

Comments
 (0)