From eab76de0fb78de296a23abb5e27b4e3a3c9335d7 Mon Sep 17 00:00:00 2001 From: Katie Date: Mon, 8 Aug 2022 10:10:23 -0400 Subject: [PATCH] Add empty object for pageData by default --- src/router/index.js | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/src/router/index.js b/src/router/index.js index 525664dd5..11e9186d2 100644 --- a/src/router/index.js +++ b/src/router/index.js @@ -159,10 +159,9 @@ async function navigate(scenario, currentRoute, optionalQuery = {}, optionalPara if (destinationFmgPageValue !== undefined) { // We're always pushing the same path, just changing query strings. Make sure our optional query strings get combined with our fmgPage one. - // Update page data to the store for next page if provided. Otherwise, keep existing page data - if (optionalPageData !== undefined) { - baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData); - } + // Update page data to the store for next page if provided. Otherwise, keep existing page data or set to empty object + const existingPageDataForPage = store.getters.pageData(destinationFmgPageValue); + baseMixin.methods.savePageDataToStore(destinationFmgPageValue, optionalPageData ? optionalPageData : existingPageDataForPage ?? {}); // if cookie and referralNumber/Date exists OR an emailAddress has been saved if ((getFunnelCookie()?.ReferralNumber && getFunnelCookie()?.ReferralDate) || store.getters.order.customer?.emailAddress) {