diff --git a/src/views/ModelPlan/TaskList/Basics/__snapshots__/index.test.tsx.snap b/src/views/ModelPlan/TaskList/Basics/__snapshots__/index.test.tsx.snap index f369adcf06..b23b9f61df 100644 --- a/src/views/ModelPlan/TaskList/Basics/__snapshots__/index.test.tsx.snap +++ b/src/views/ModelPlan/TaskList/Basics/__snapshots__/index.test.tsx.snap @@ -156,12 +156,12 @@ exports[`Model Plan Basics page > disables and clears checkbox when user selects
@@ -214,7 +214,7 @@ exports[`Model Plan Basics page > disables and clears checkbox when user selects >
@@ -1572,12 +1569,12 @@ exports[`Model Plan Basics page > matches snapshot 1`] = `
@@ -1630,7 +1627,7 @@ exports[`Model Plan Basics page > matches snapshot 1`] = ` >
diff --git a/src/views/ModelPlan/TaskList/Basics/index.tsx b/src/views/ModelPlan/TaskList/Basics/index.tsx index d9eb320d07..06e2a28209 100644 --- a/src/views/ModelPlan/TaskList/Basics/index.tsx +++ b/src/views/ModelPlan/TaskList/Basics/index.tsx @@ -1,4 +1,4 @@ -import React, { Fragment, useRef, useState } from 'react'; +import React, { Fragment, useRef } from 'react'; import { useTranslation } from 'react-i18next'; import { Link, Route, Switch, useHistory, useParams } from 'react-router-dom'; import { @@ -17,7 +17,7 @@ import { TextInput } from '@trussworks/react-uswds'; import classNames from 'classnames'; -import { Field, FieldArray, Form, Formik, FormikProps } from 'formik'; +import { Field, Form, Formik, FormikProps } from 'formik'; import { CmsCenter, GetBasicsQuery, @@ -70,10 +70,6 @@ const BasicsContent = () => { const history = useHistory(); - const [areCmmiGroupsShown, setAreCmmiGroupsShown] = useState( - formikRef?.current?.values.basics.cmsCenters.includes(CmsCenter.CMMI) - ); - const { data, loading, error } = useGetBasicsQuery({ variables: { id: modelID @@ -274,11 +270,11 @@ const BasicsContent = () => { -
@@ -421,6 +417,8 @@ const BasicsContent = () => { } value={key} checked={values.basics.modelCategory === key} + // the onChange below is necessary to have a dynamic interaction + // with the Additional Model Categories question onChange={() => { setFieldValue('basics.modelCategory', key); if ( @@ -443,13 +441,14 @@ const BasicsContent = () => { -
- ( - <> - - - - {flatErrors['basics.cmsCenters']} - - - {getKeys(cmsCentersConfig.options).map( - center => { - return ( - - ) => { - if (e.target.checked) { - arrayHelpers.push(e.target.value); - } else { - const idx = values.basics.cmsCenters.indexOf( - e.target.value as CmsCenter - ); - arrayHelpers.remove(idx); - } - if ( - e.target.value === CmsCenter.CMMI - ) { - setAreCmmiGroupsShown( - !areCmmiGroupsShown - ); - } - }} - /> - ); - } - )} - - )} - /> -
+ + + + {flatErrors['basics.cmsCenters']} + + + {getKeys(cmsCentersConfig.options).map(center => { + return ( + + ); + })}
+