From a01cba532cbfff1762ede66814263fe72a2d4f18 Mon Sep 17 00:00:00 2001 From: Mark Harris Date: Wed, 1 Dec 2021 17:10:08 -0500 Subject: [PATCH] miscellaneous comments --- src/layouts/vehicle-year/vehicle-year.vue | 11 ++++++----- src/store/index.js | 7 +++++++ 2 files changed, 13 insertions(+), 5 deletions(-) diff --git a/src/layouts/vehicle-year/vehicle-year.vue b/src/layouts/vehicle-year/vehicle-year.vue index 941d1328c..8c0c24004 100644 --- a/src/layouts/vehicle-year/vehicle-year.vue +++ b/src/layouts/vehicle-year/vehicle-year.vue @@ -30,11 +30,14 @@ export default { }; }, computed: {}, + beforeRouteEnter(to, from, next) { + // Call APIs const contentPromise = fetchCmsContentForPage(to.query.fmgPage); const getVehicleYearPromise = store.dispatch(storeActions.GET_VEHICLE_YEARS, {}); + // Settle promises and get results const promiseResultMap = [ { resultKey: "getPageContent", @@ -45,19 +48,17 @@ export default { promise: getVehicleYearPromise, }, ]; - settleAllPromises(promiseResultMap).then((resultMap) => { - // Call our next function to transition to the next page. + // Call the "next" function to complete the transition to this page. next((vm) => { vm.pageHeaderWidgets = resultMap.getPageContent.PageHeaderWidget[0]; vm.radioQuestionWidgets = resultMap.getPageContent.RadioQuestionWidget[0]; vm.vehicleYears = resultMap.getVehicleYear; - }); - + }); }); - }, + components: { yearQuestion, pageHeader, diff --git a/src/store/index.js b/src/store/index.js index 0976690b7..abe72764e 100644 --- a/src/store/index.js +++ b/src/store/index.js @@ -9,6 +9,11 @@ export default createStore({ storage: window.sessionStorage, }), ], + + // IMPORTANT: Be VERY careful when modifying these fields for at least a few reasons: + // * The CMS can reference the fields by name + // * Return users may have a previous "version" of the model, and we don't want + // them to have a breaking experience, because the model might have changed. state: { order: { vehicle: { @@ -63,6 +68,8 @@ export default createStore({ experiments: null, } }, + // See IMPORTANT note at top of "state" declaration. + mutations: { updateVehicleImage(state, data) { state.order.vehicle.imageSrc = data.imgSrc;