Skip to content

Commit

Permalink
Account for undefined provider
Browse files Browse the repository at this point in the history
  • Loading branch information
juancstlm-a6 committed Jan 17, 2025
1 parent ae37aa4 commit 07e2a01
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/applications/vaos/referral-appointments/ReviewAndConfirm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const ReviewAndConfirm = props => {
const { provider, loading, failed } = useGetProviderById(
currentReferral.providerId,
);
const slotDetails = getSlotById(provider.slots, selectedSlot);

const facilityTimeZone = getTimezoneByFacilityId(
currentReferral.ReferringFacilityInfo.FacilityCode,
);
Expand Down Expand Up @@ -59,20 +59,20 @@ const ReviewAndConfirm = props => {
scrollAndFocus('h2');
}
},
[loading, failed, provider, dispatch],
[loading, failed, provider],
);

useEffect(
() => {
if (!selectedSlot && savedSelectedSlot && provider.slots) {
if (!selectedSlot && savedSelectedSlot && provider?.slots) {
const savedSlot = getSlotById(provider.slots, savedSelectedSlot);
if (!savedSlot) {
routeToCCPage(history, 'scheduleReferral');
}
dispatch(setSelectedSlot(savedSlot.id));
}
},
[dispatch, savedSelectedSlot, provider.slots, history, selectedSlot],
[dispatch, savedSelectedSlot, provider?.slots, history, selectedSlot],
);

const handleGoBack = e => {
Expand All @@ -91,6 +91,9 @@ const ReviewAndConfirm = props => {
</div>
);
}

const slotDetails = getSlotById(provider.slots, selectedSlot);

const headingStyles =
'vads-u-margin--0 vads-u-font-family--sans vads-u-font-weight--bold vads-u-font-size--source-sans-normalized';
return (
Expand Down

0 comments on commit 07e2a01

Please sign in to comment.