From b7a39a236d9bd6718b59ba6818e95721e61fc9b8 Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Mon, 15 Jan 2024 08:37:37 +0100 Subject: [PATCH] fix(query-preview): fix e2e tests --- packages/x-components/src/views/home/Home.vue | 8 -------- .../src/x-modules/queries-preview/store/module.ts | 13 +++++++++---- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/packages/x-components/src/views/home/Home.vue b/packages/x-components/src/views/home/Home.vue index 5ee587b4d0..3ec10de596 100644 --- a/packages/x-components/src/views/home/Home.vue +++ b/packages/x-components/src/views/home/Home.vue @@ -633,14 +633,6 @@ extraParams: { store: 'Gijón' }, filters: ['categoryIds:66dd06d9f'] }, - { - query: 'charger' - //filters: ['categoryIds:7d6e18d0f'] - }, - { - query: 'summer dress', - filters: ['brand:marni'] - }, { query: 'summer dress', filters: ['categoryIds:5b612edb5', 'brand:marni'] diff --git a/packages/x-components/src/x-modules/queries-preview/store/module.ts b/packages/x-components/src/x-modules/queries-preview/store/module.ts index c5e4dcc1b9..67c55fa254 100644 --- a/packages/x-components/src/x-modules/queries-preview/store/module.ts +++ b/packages/x-components/src/x-modules/queries-preview/store/module.ts @@ -44,12 +44,17 @@ export const queriesPreviewXStoreModule: QueriesPreviewXStoreModule = { setConfig, mergeConfig, addQueryPreviewInstance(state, query: string) { - state.queriesPreview[query].instances += 1; + if (state.queriesPreview[query]) { + state.queriesPreview[query].instances += 1; + } }, removeQueryPreviewInstance(state, { query, cache }: { query: string; cache: boolean }) { - state.queriesPreview[query].instances -= 1; - if (!cache && state.queriesPreview[query].instances === 0) { - Vue.delete(state.queriesPreview, query); + if (state.queriesPreview[query]) { + state.queriesPreview[query].instances -= 1; + + if (!cache && state.queriesPreview[query].instances === 0) { + Vue.delete(state.queriesPreview, query); + } } } },