From 86c93d6b91a08672a5c72896cf9e88394617d794 Mon Sep 17 00:00:00 2001 From: Wes Cutting Date: Tue, 31 Oct 2023 12:31:00 -0500 Subject: [PATCH] Handle deprecated variance explanation reasons (#1486) Co-authored-by: Carson Full --- .../ExplanationOfProgress.graphql | 1 + .../ExplanationOfProgress.tsx | 22 ++++++++++++++++--- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/scenes/ProgressReports/EditForm/Steps/ExplanationOfProgress/ExplanationOfProgress.graphql b/src/scenes/ProgressReports/EditForm/Steps/ExplanationOfProgress/ExplanationOfProgress.graphql index 0e37c23b3c..dac4e1ae94 100644 --- a/src/scenes/ProgressReports/EditForm/Steps/ExplanationOfProgress/ExplanationOfProgress.graphql +++ b/src/scenes/ProgressReports/EditForm/Steps/ExplanationOfProgress/ExplanationOfProgress.graphql @@ -9,6 +9,7 @@ fragment ExplanationOfProgressStep on ProgressReport { ahead behind onTime + deprecated } reasons { ...SecuredStringList diff --git a/src/scenes/ProgressReports/EditForm/Steps/ExplanationOfProgress/ExplanationOfProgress.tsx b/src/scenes/ProgressReports/EditForm/Steps/ExplanationOfProgress/ExplanationOfProgress.tsx index 52385f5340..8e42753197 100644 --- a/src/scenes/ProgressReports/EditForm/Steps/ExplanationOfProgress/ExplanationOfProgress.tsx +++ b/src/scenes/ProgressReports/EditForm/Steps/ExplanationOfProgress/ExplanationOfProgress.tsx @@ -122,7 +122,7 @@ export const ExplanationOfProgress: StepComponent = ({ report }) => { autoSubmit keepDirtyOnReinitialize > - {({ handleSubmit, values: { group }, submitting }) => ( + {({ handleSubmit, values: { group, reasons }, submitting }) => ( { + > + {optionsByGroup[group].flatMap((reason) => { + const isDeprecated = + optionsByGroup.deprecated.includes(reason); + if (isDeprecated && reason !== reasons) { + // Don't even show deprecated options if they are not currently selected + return []; + } + return ( + + ); + })} + )}