Skip to content

Commit

Permalink
Merge pull request #859 from hackforla/843-flow-bug
Browse files Browse the repository at this point in the history
#843 flow bug
  • Loading branch information
sydneywalcoff authored Mar 6, 2023
2 parents e1d6b3c + be2339e commit 69e35b2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { useCallback, useContext } from 'react';
import React, { useContext } from 'react';
import { makeStyles, createStyles } from '@material-ui/core';

import FormStateContext from 'contexts/FormStateContext';
Expand Down Expand Up @@ -47,21 +47,21 @@ export default function FlowNavigation({
const backBtnTheme =
appTheme === 'dark' ? 'transparent-on-dark' : 'transparent-on-light';

const handleBack = useCallback(() => {
const handleBack = () => {
if (onBack) {
onBack();
} else {
goBackStep();
}
}, []);
};

const handleNext = useCallback(() => {
const handleNext = () => {
if (onNext) {
onNext();
} else {
goNextStep();
}
}, []);
};

return (
<div className={utilityClasses.buttonContainer}>
Expand Down
10 changes: 9 additions & 1 deletion products/statement-generator/src/contexts/FormStateContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export const FormStateContextProvider = ({
if (
(suggestedNext === AppUrl.Unemployment ||
suggestedNext === AppUrl.UnemploymentPreview) &&
formState.involvement.isJobChecked
!formState.involvement.isUnemploymentChecked
) {
return getNextStep(suggestedNext);
}
Expand Down Expand Up @@ -75,6 +75,14 @@ export const FormStateContextProvider = ({
return getNextStep(suggestedNext);
}

if (
(suggestedNext === AppUrl.SomethingElse ||
suggestedNext === AppUrl.SomethingElsePreview) &&
!formState.involvement.isSomethingElseChecked
) {
return getNextStep(suggestedNext);
}

return suggestedNext;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,19 +56,6 @@ function InvolvementInitialFlow() {

const onCheckboxChange = (evt: React.ChangeEvent<HTMLInputElement>) => {
const { id, checked } = evt.currentTarget;
if (id === 'isNoneChecked' && checked) {
updateStepToForm({
involvement: {
isJobChecked: false,
isUnemployementChecked: false,
isRecoveryChecked: false,
isSchoolChecked: false,
isParentingChecked: false,
isCommunityChecked: false,
},
});
return;
}
const changes = {
[id]: Boolean(checked),
};
Expand Down

0 comments on commit 69e35b2

Please sign in to comment.