From b3fd46350fb1a6f5cfdca59ba858c61228fa7fae Mon Sep 17 00:00:00 2001 From: Chloe Herd Date: Thu, 5 Jun 2025 14:04:44 -0400 Subject: [PATCH] Remove premature consumption of zip query --- src/layouts/estimate/estimate.vue | 4 ++-- src/router/methods/helpers/querystring-stash.js | 9 +++++++++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/layouts/estimate/estimate.vue b/src/layouts/estimate/estimate.vue index 811cd1a86..2818d2ecb 100644 --- a/src/layouts/estimate/estimate.vue +++ b/src/layouts/estimate/estimate.vue @@ -62,7 +62,7 @@ import { saveSession } from "@/helpers/heritage-integration/order-helper.js"; import baseMixin from "@/mixins/base-mixin.js"; import { queryStrings } from "@/constants/query-strings"; import { nextTick } from "vue"; -import { consumeQueryFromStash } from "@/router/methods/helpers/querystring-stash"; +import { peekQueryFromStash } from "@/router/methods/helpers/querystring-stash"; // Define Validation Rules defineRule("zip-required", required(errorMessages.SERVICE_ZIP_REQUIRED)); @@ -100,7 +100,7 @@ export default { } const zip = - consumeQueryFromStash(queryStrings.ZIP_CODE) ?? + peekQueryFromStash(queryStrings.ZIP_CODE) ?? store.getters.order.serviceLocation.zipCode; var vinByAddressPromise; diff --git a/src/router/methods/helpers/querystring-stash.js b/src/router/methods/helpers/querystring-stash.js index 96b206572..b000f8feb 100644 --- a/src/router/methods/helpers/querystring-stash.js +++ b/src/router/methods/helpers/querystring-stash.js @@ -1,4 +1,5 @@ import { reactive } from "vue"; +import { debugLog } from "@/helpers/debug-log-helper"; const queryStash = reactive({ queries: [], @@ -27,10 +28,18 @@ export function stashAllQueries(toRoute) { } function getStashedQuery(key) { + debugLog(`Fetching querystring with key:`, key); const match = queryStash.queries.find( (entry) => entry?.key?.toLowerCase() === key?.toLowerCase() ); + if (match) { + debugLog(`Found result:`, match.value); + debugLog(`Already consumed:`, match.used); + } else { + debugLog(`Found no result`); + } + return match; }