diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index cfec5923d..15a9749e7 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -252,6 +252,25 @@ export default { } else if (this.$store.getters.order.referralNumber?.length === 6) { await this.navigateForwardWithSingleCarMatch(); } else if (this.isRepair) { + const supportingItemsPromise = await this.dispatchStoreAction( + storeActions.GET_SUPPORTING_ITEMS + ); + + const promiseResultMap = [ + { + resultKey: "supportingItems", + promise: supportingItemsPromise, + }, + ]; + + const resultMap = await settleAllPromises(promiseResultMap); + + this.dispatchStoreAction( + this.storeActions.SAVE_SUPPORTING_ITEMS, + resultMap.supportingItems, + false + ); + // call saveSession here - navigateWithSaving saves too late in the flow await saveSession({}); return this.$router.navigateWithoutSaving( diff --git a/src/layouts/quote/service-package-question/service-package-question.vue b/src/layouts/quote/service-package-question/service-package-question.vue index 1d9235374..eede868a5 100644 --- a/src/layouts/quote/service-package-question/service-package-question.vue +++ b/src/layouts/quote/service-package-question/service-package-question.vue @@ -42,7 +42,7 @@ export default { }, watch: { availableLineItems() { - if (this.$store.getters.lineItems.supportingItems) { + if (this.$store.getters.lineItems.vaps) { this.selectDefaultPackage(); } }, @@ -212,18 +212,20 @@ export default { selectDefaultPackage() { const vapsFromStore = this.$store.getters.lineItems.vaps; let lowestTierForPackage = packageNames.TIER_ONE; - vapsFromStore.every((vapsItem) => { - let lowestTierForThisItem = this.getLowestTierForThisItem(vapsItem); - if (lowestTierForThisItem === packageNames.TIER_THREE) { - lowestTierForPackage = packageNames.TIER_THREE; - return false; - } else if (lowestTierForThisItem === packageNames.TIER_TWO) { - lowestTierForPackage = packageNames.TIER_TWO; - return true; - } else { - return true; - } - }); + if (vapsFromStore.length > 0) { + vapsFromStore.every((vapsItem) => { + let lowestTierForThisItem = this.getLowestTierForThisItem(vapsItem); + if (lowestTierForThisItem === packageNames.TIER_THREE) { + lowestTierForPackage = packageNames.TIER_THREE; + return false; + } else if (lowestTierForThisItem === packageNames.TIER_TWO) { + lowestTierForPackage = packageNames.TIER_TWO; + return true; + } else { + return true; + } + }); + } this.selectedPackageName = lowestTierForPackage; }, getLowestTierForThisItem(vapsItem) {