Change where modal open logic happens
prevents flashing the incorrect data
This commit is contained in:
parent
7324053990
commit
c0a93abfbf
1 changed files with 17 additions and 21 deletions
|
|
@ -13,7 +13,6 @@
|
||||||
<modal
|
<modal
|
||||||
ref="shopQuestionModal"
|
ref="shopQuestionModal"
|
||||||
:headerText="modalHeaderText"
|
:headerText="modalHeaderText"
|
||||||
:onModalOpenedCallback="onModalOpened"
|
|
||||||
:onModalClosedCallback="onModalClosed"
|
:onModalClosedCallback="onModalClosed"
|
||||||
:footerButtonText="modalFooterText"
|
:footerButtonText="modalFooterText"
|
||||||
:footerButtonDisabled="
|
:footerButtonDisabled="
|
||||||
|
|
@ -164,6 +163,23 @@ export default {
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
openModal() {
|
openModal() {
|
||||||
|
// Reset local state from parent
|
||||||
|
this.localShopProviderData = this.shopProviderDataFromParent;
|
||||||
|
this.localSelectedProviderNumber = this.selectedProviderNumberFromParent;
|
||||||
|
this.localZipCode = this.zipCodeFromParent;
|
||||||
|
this.answers = [];
|
||||||
|
|
||||||
|
const selectedProviderNumberFromParentIndex = this.shopProviders.findIndex(
|
||||||
|
(provider) => provider.providerNumber == this.selectedProviderNumberFromParent
|
||||||
|
);
|
||||||
|
|
||||||
|
if (selectedProviderNumberFromParentIndex > -1) {
|
||||||
|
this.indexOfLastShopToBeDisplayed = Math.ceil((selectedProviderNumberFromParentIndex + 1) / 3) * 3;
|
||||||
|
} else {
|
||||||
|
this.indexOfLastShopToBeDisplayed = 3;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.updateShopsForZip(this.localZipCode);
|
||||||
this.$refs.shopQuestionModal.openModal();
|
this.$refs.shopQuestionModal.openModal();
|
||||||
},
|
},
|
||||||
updateShopListWithNextShops(numberToGet = 3) {
|
updateShopListWithNextShops(numberToGet = 3) {
|
||||||
|
|
@ -221,26 +237,6 @@ export default {
|
||||||
|
|
||||||
this.pushEventToGA(this.GaCategories.SERVICE_LOCATION, this.GaActions.MORE_LOCATIONS_CLICKED, joinedShops, true);
|
this.pushEventToGA(this.GaCategories.SERVICE_LOCATION, this.GaActions.MORE_LOCATIONS_CLICKED, joinedShops, true);
|
||||||
},
|
},
|
||||||
onModalOpened() {
|
|
||||||
// Reset local state from parent
|
|
||||||
this.localShopProviderData = this.shopProviderDataFromParent;
|
|
||||||
this.localSelectedProviderNumber = this.selectedProviderNumberFromParent;
|
|
||||||
this.localZipCode = this.zipCodeFromParent;
|
|
||||||
this.answers = [];
|
|
||||||
|
|
||||||
const selectedProviderNumberFromParentIndex = this.shopProviders.findIndex(
|
|
||||||
(provider) => provider.providerNumber == this.selectedProviderNumberFromParent
|
|
||||||
);
|
|
||||||
|
|
||||||
if (selectedProviderNumberFromParentIndex > -1) {
|
|
||||||
this.indexOfLastShopToBeDisplayed = Math.ceil((selectedProviderNumberFromParentIndex + 1) / 3) * 3;
|
|
||||||
} else {
|
|
||||||
this.indexOfLastShopToBeDisplayed = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
this.updateShopsForZip(this.localZipCode);
|
|
||||||
|
|
||||||
},
|
|
||||||
closeModal() {
|
closeModal() {
|
||||||
this.modal.closeModal();
|
this.modal.closeModal();
|
||||||
},
|
},
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue