diff --git a/src/mixins/vin-pages-mixin.js b/src/mixins/vin-pages-mixin.js index 82be61557..ddda182ba 100644 --- a/src/mixins/vin-pages-mixin.js +++ b/src/mixins/vin-pages-mixin.js @@ -1,13 +1,16 @@ import { storeActions } from "@/constants/store-actions.js"; +import store from "@/store"; import vehicleQuestionsMixin from "@/mixins/vehicle-questions-mixin"; import { saveOrder } from "@/helpers/heritage-integration/order-helper.js"; export default { methods: { async navigateForwardWithSingleCarMatch() { - // We want to save the order before calling getPartsOrQuestions because that call is lengthy - saveOrder(); - + // If we have not already saved a session, we need to save one now before the lengthy call to getPartsOrQuestions + if (!store.getters.applicationUser.savedSessionId) { + saveOrder(); + } + const result = await this.dispatchStoreAction(storeActions.GET_PARTS_OR_QUESTIONS); const partsOrQuestions = result.data.partsOrQuestions; diff --git a/src/mixins/vin-pages-mixin.spec.js b/src/mixins/vin-pages-mixin.spec.js index a4b2b136e..0ac493b42 100644 --- a/src/mixins/vin-pages-mixin.spec.js +++ b/src/mixins/vin-pages-mixin.spec.js @@ -50,7 +50,12 @@ function setupMocks({ partsOrQuestions = [] }) { navigate: jest.fn(), navigateWithSaving: jest.fn(), navigateWithoutSaving: jest.fn(), }, store: { - commit: jest.fn() + commit: jest.fn(), + getters: { + applicationUser: { + savedSessionId: 1 + } + } } });