Skip to content

Commit

Permalink
Null check
Browse files Browse the repository at this point in the history
  • Loading branch information
hfhelgason committed Jan 20, 2025
1 parent 674d4d1 commit 99a20b6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ export const childInfoSubSection = buildSubSection({
condition: (answers) => {
const { childInfo } = getApplicationAnswers(answers)

return !!childInfo.usePronounAndPreferredName?.includes(YES)
return !!childInfo?.usePronounAndPreferredName?.includes(YES)
},
defaultValue: (application: Application) =>
getApplicationExternalData(application.externalData)
Expand All @@ -109,7 +109,7 @@ export const childInfoSubSection = buildSubSection({
condition: (answers) => {
const { childInfo } = getApplicationAnswers(answers)

return !!childInfo.usePronounAndPreferredName?.includes(YES)
return !!childInfo?.usePronounAndPreferredName?.includes(YES)
},
component: 'FriggOptionsAsyncSelectField',
defaultValue: (application: Application) =>
Expand Down Expand Up @@ -154,7 +154,7 @@ export const childInfoSubSection = buildSubSection({
condition: (answers) => {
const { childInfo } = getApplicationAnswers(answers)

return childInfo.differentPlaceOfResidence === YES
return childInfo?.differentPlaceOfResidence === YES
},
}),
buildTextField({
Expand All @@ -166,7 +166,7 @@ export const childInfoSubSection = buildSubSection({
condition: (answers) => {
const { childInfo } = getApplicationAnswers(answers)

return childInfo.differentPlaceOfResidence === YES
return childInfo?.differentPlaceOfResidence === YES
},
}),
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ const NewPrimarySchoolTemplate: ApplicationTemplate<
clearPlaceOfResidence: assign((context) => {
const { application } = context
const { childInfo } = getApplicationAnswers(application.answers)
if (childInfo.differentPlaceOfResidence === NO) {
if (childInfo?.differentPlaceOfResidence === NO) {
unset(application.answers, 'childInfo.placeOfResidence')
}
return context
Expand Down

0 comments on commit 99a20b6

Please sign in to comment.