From b3ce8a0f27dccadb52e1d7464d57fdebd61e18d3 Mon Sep 17 00:00:00 2001 From: Bartosz Herba Date: Fri, 1 Apr 2022 06:44:48 +0200 Subject: [PATCH] fix(category): move products loading to onMount hook to avoid caching prices (#793) * refactor(prices): make prices non cachable - add usePrice composable in catalog module - rework category page to load prices onMounted lifecycle to avoid caching * refactor(home): make new product carousel non cachable - load products data onMounted to avoid price caching * fix(theme): mobile store banner - replace SfButton with SfLink so we can have images inside elements without breaking hydration * refactor(theme): change the way related and upsell products are loaded - upsell/related products on the PDP will be now loaded onMounted hook M2-306 --- .../theme/components/MobileStoreBanner.vue | 14 +++--- packages/theme/components/RelatedProducts.vue | 6 ++- packages/theme/components/UpsellProducts.vue | 4 +- packages/theme/composables/useApi/index.ts | 6 +++ .../theme/modules/catalog/pages/default.vue | 40 ++++++++++++---- .../pricing/__tests__/usePrice.spec.js | 48 +++++++++++++++++++ .../catalog/pricing/getPricesQuery.gql.ts | 33 +++++++++++++ .../theme/modules/catalog/pricing/usePrice.ts | 28 +++++++++++ packages/theme/pages/Home.vue | 11 ++--- 9 files changed, 166 insertions(+), 24 deletions(-) create mode 100644 packages/theme/modules/catalog/pricing/__tests__/usePrice.spec.js create mode 100644 packages/theme/modules/catalog/pricing/getPricesQuery.gql.ts create mode 100644 packages/theme/modules/catalog/pricing/usePrice.ts diff --git a/packages/theme/components/MobileStoreBanner.vue b/packages/theme/components/MobileStoreBanner.vue index 644874e63..692dc713f 100644 --- a/packages/theme/components/MobileStoreBanner.vue +++ b/packages/theme/components/MobileStoreBanner.vue @@ -7,10 +7,11 @@ > @@ -40,7 +42,7 @@