CASH-1790: add a check if loaded to fix bug

This commit is contained in:
Adam Caouette 2025-12-01 02:41:54 -05:00
parent e4da847a3d
commit c6bdbf8a03
2 changed files with 17 additions and 2 deletions

View file

@ -167,6 +167,7 @@
:timeSlotsForSelectedDate="timeSlotsForSelectedDate"
:isSameDay="isSameDay"
:selectedRouteCodeData="selectedRouteCodeData"
:isDatePickerDoneInitializing="isDatePickerDoneInitializing"
@waitListRequested="handleWaitListRequested" />
<navbar
cmsWidgetName="FunnelFooterWidget"
@ -474,6 +475,7 @@ export default {
experimentSettings.SHOW_MOBILE_FIRST_APPT,
"true"
),
isDatePickerDoneInitializing: false,
};
},
async beforeRouteEnter(to, from, next) {
@ -1218,6 +1220,8 @@ export default {
}
this.isShowMobileFirstAppt && this.hideLoadingModal();
await this.$nextTick();
this.isDatePickerDoneInitializing = true;
},
getScheduleApiResponse,
getServiceZipCtuCodeFromStore() {
@ -1853,6 +1857,10 @@ export default {
},
},
selectedDate(newValue, oldValue) {
if (!this.isDatePickerDoneInitializing) {
return;
} // needed otherwise it nulls selecdtedTimeSlotInfo too early and prevents a previously selected time slot from auto-selecting
// Clear time slot selection if date selected changes
const selectedDate = this.getSelectedDateFromStore();
if (oldValue && this.appointmentType === AppointmentTypeStrings.MOBILE) {

View file

@ -36,7 +36,10 @@
isInshopOrDropOffAppointment ? 'is-inshop-or-drop-off-appointment' : '',
]"
:answers="availableTimeSlots"
:lazyLoad="{ isLazyLoad: !isMobileAppointment, amountToLoad: 10 }"
:lazyLoad="{
isLazyLoad: !isMobileAppointment && !selectedAnswerForTimeSlots,
amountToLoad: 10,
}"
groupName="chooseTimeSlot"
textPosition="text-center"
questionText="Available times:"
@ -134,6 +137,7 @@ export default {
isSameDay: Boolean,
displayWaitList: Boolean,
selectedRouteCodeData: Object,
isDatePickerDoneInitializing: Boolean,
},
data() {
return {
@ -187,6 +191,9 @@ export default {
this.updateDropoffAndTimeSlotAnswersFromSelectedRouteCodeData(newValue);
},
timeSlotsForSelectedDate() {
if (!this.isDatePickerDoneInitializing) {
return;
} // needed otherwise it nulls these too early and prevents a previously selected time slot from auto-selecting
this.selectedAnswerForDropOffOrInshop = null;
this.selectedAnswerForTimeSlots = null;
this.autoSelectTimeSlotIfOnlyOneIsAvailable();
@ -390,7 +397,7 @@ export default {
this.answersForDropOffQuestion[0].value !== PICK_A_TIME_BUTTON_VALUE
);
},
shouldDisplayTimeSlotQuestion() {
displayTimeSlotQuestion() {
return (
this.selectedAnswerForDropOffOrInshop == PICK_A_TIME_BUTTON_VALUE ||
!this.isDropOffAppointmentAvailable