CASH-1790: add check to keep watches from activating before initial load is complete to fix bug

(cherry picked from commit 9e9f6257a6)
This commit is contained in:
Adam Caouette 2025-12-04 16:28:56 -05:00
parent 205b7f1cf3
commit 8cd70f0467
2 changed files with 15 additions and 4 deletions

View file

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

View file

@ -36,10 +36,9 @@
isInshopOrDropOffAppointment ? 'is-inshop-or-drop-off-appointment' : '', isInshopOrDropOffAppointment ? 'is-inshop-or-drop-off-appointment' : '',
]" ]"
:answers="availableTimeSlots" :answers="availableTimeSlots"
:lazyLoad="{ isLazyLoad: !isMobileAppointment, amountToLoad: 10 }" :lazyLoad="{ isLazyLoad: !isMobileAppointment && !selectedAnswerForTimeSlots, amountToLoad: 10 }"
groupName="chooseTimeSlot" groupName="chooseTimeSlot"
textPosition="text-center" textPosition="text-center"
v-model="selectedAnswerForTimeSlots"
questionText="Available times:" questionText="Available times:"
isRequired isRequired
validationRules="time-slot-required" /> validationRules="time-slot-required" />
@ -135,7 +134,8 @@ export default {
isSameDay: Boolean, isSameDay: Boolean,
displayWaitList: Boolean, displayWaitList: Boolean,
selectedRouteCodeData: Object, selectedRouteCodeData: Object,
}, isDatePickerDoneInitializing: Boolean,
},
data() { data() {
return { return {
timeSlotModalListButton: timeSlotModalListButton, timeSlotModalListButton: timeSlotModalListButton,
@ -188,6 +188,9 @@ export default {
this.updateDropoffAndTimeSlotAnswersFromSelectedRouteCodeData(newValue); this.updateDropoffAndTimeSlotAnswersFromSelectedRouteCodeData(newValue);
}, },
timeSlotsForSelectedDate() { 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.selectedAnswerForDropOffOrInshop = null;
this.selectedAnswerForTimeSlots = null; this.selectedAnswerForTimeSlots = null;
this.autoSelectTimeSlotIfOnlyOneIsAvailable(); this.autoSelectTimeSlotIfOnlyOneIsAvailable();
@ -391,7 +394,7 @@ export default {
this.answersForDropOffQuestion[0].value !== PICK_A_TIME_BUTTON_VALUE this.answersForDropOffQuestion[0].value !== PICK_A_TIME_BUTTON_VALUE
); );
}, },
shouldDisplayTimeSlotQuestion() { displayTimeSlotQuestion() {
return ( return (
this.selectedAnswerForDropOffOrInshop == PICK_A_TIME_BUTTON_VALUE || this.selectedAnswerForDropOffOrInshop == PICK_A_TIME_BUTTON_VALUE ||
!this.isDropOffAppointmentAvailable !this.isDropOffAppointmentAvailable