Fix issue where answer was not auto selected

If it was not in the initial three questions it didn't load correctly
This commit is contained in:
Scott Kiener 2025-07-16 15:19:15 -04:00
parent 59cf55a7fd
commit c4aa209413

View file

@ -14,6 +14,7 @@
ref="shopQuestionModal"
:headerText="modalHeaderText"
:onModalClosedCallback="onModalClosed"
:onModalOpenedCallback="updateSelectedAnswer"
:footerButtonText="modalFooterText"
:footerButtonDisabled="
displayInvalidZipAlert || displayNoShopsAlert || !localSelectedProviderNumber
@ -165,9 +166,11 @@ export default {
openModal() {
// Reset local state from parent
this.localShopProviderData = this.shopProviderDataFromParent;
this.localSelectedProviderNumber = this.selectedProviderNumberFromParent;
this.localZipCode = this.zipCodeFromParent;
this.answers = [];
// This will be set once the modal is open (updateSelectedAnswer()) to ensure that the
// correct answer is selected
this.localSelectedProviderNumber = null;
const selectedProviderNumberFromParentIndex = this.shopProviders.findIndex(
(provider) => provider.providerNumber == this.selectedProviderNumberFromParent
@ -183,6 +186,9 @@ export default {
this.$refs.shopQuestionModal.openModal();
},
updateSelectedAnswer() {
this.localSelectedProviderNumber = this.selectedProviderNumberFromParent;
},
updateShopListWithNextShops(numberToGet = 3) {
//gaAction = this.GaActions.SHOPS_FIRST_DISPLAYED; --This needs to actually fire on initial display, can never happen here