From 94f657864cadc15046bd217611d5f28e76dc600e Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Mon, 15 Apr 2024 12:26:52 +0200 Subject: [PATCH 1/6] feat: migrate queryPreview component --- .../components/query-preview.vue | 486 +++++++++--------- 1 file changed, 255 insertions(+), 231 deletions(-) diff --git a/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue b/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue index 191e81770e..9a7c34d921 100644 --- a/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue +++ b/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue @@ -35,16 +35,22 @@ ## Events From eb7c1f835c97fcef75991d9faa3cd8ef858b708f Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Tue, 16 Apr 2024 14:48:17 +0200 Subject: [PATCH 2/6] feat: migrate queryPreviewList component --- .../components/query-preview-list.vue | 208 ++++++++++-------- .../components/query-preview.vue | 37 ++-- 2 files changed, 128 insertions(+), 117 deletions(-) diff --git a/packages/x-components/src/x-modules/queries-preview/components/query-preview-list.vue b/packages/x-components/src/x-modules/queries-preview/components/query-preview-list.vue index c4393300f6..cd0fb0f9d4 100644 --- a/packages/x-components/src/x-modules/queries-preview/components/query-preview-list.vue +++ b/packages/x-components/src/x-modules/queries-preview/components/query-preview-list.vue @@ -20,14 +20,14 @@ diff --git a/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue b/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue index 9a7c34d921..a85c5911a4 100644 --- a/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue +++ b/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue @@ -41,7 +41,6 @@ defineComponent, inject, onBeforeUnmount, - onMounted, PropType, provide, Ref, @@ -93,7 +92,7 @@ * @public */ queryFeature: { - type: Object as PropType + type: String as PropType }, /** * Number of query preview results to be rendered. @@ -252,27 +251,25 @@ * * @internal */ - onMounted(() => { - watch(queryPreviewRequest, (newRequest, oldRequest) => { - if (!deepEqual(newRequest, oldRequest)) { - emitQueryPreviewRequestUpdated.value(newRequest); - } - }); - - const cachedQueryPreview = previewResults.value[queryPreviewHash.value]; - - // If the query has been saved it will emit load instead of the emitting the updated request. - if (cachedQueryPreview?.status === 'success') { - emit('load', queryPreviewHash.value); - xBus.emit('QueryPreviewMounted', queryPreviewHash.value, { - priority: 0, - replaceable: false - }); - } else { - emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value); + watch(queryPreviewRequest, (newRequest, oldRequest) => { + if (!deepEqual(newRequest, oldRequest)) { + emitQueryPreviewRequestUpdated.value(newRequest); } }); + const cachedQueryPreview = previewResults.value[queryPreviewHash.value]; + + // If the query has been saved it will emit load instead of the emitting the updated request. + if (cachedQueryPreview?.status === 'success') { + emit('load', queryPreviewHash.value); + xBus.emit('QueryPreviewMounted', queryPreviewHash.value, { + priority: 0, + replaceable: false + }); + } else { + emitQueryPreviewRequestUpdated.value(queryPreviewRequest.value); + } + /** * Cancels the (remaining) requests when the component is destroyed * via the `debounce.cancel()` method. From a87dccec9f58dcdc087373389c41dcc684ce64bc Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Wed, 17 Apr 2024 10:43:27 +0200 Subject: [PATCH 3/6] chore: location inject --- .../x-modules/queries-preview/components/query-preview.vue | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue b/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue index a85c5911a4..8ed1fd7fce 100644 --- a/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue +++ b/packages/x-components/src/x-modules/queries-preview/components/query-preview.vue @@ -198,7 +198,11 @@ * * @internal */ - const location = inject('location', undefined); + const injectedLocation = inject | FeatureLocation>('location', 'none'); + const location = + typeof injectedLocation === 'object' && 'value' in injectedLocation + ? injectedLocation.value + : injectedLocation; /** * The computed request object to be used to retrieve the query preview results. From f2a8a8591cff8e5f7d03d54c579adb5fe21be17f Mon Sep 17 00:00:00 2001 From: Laura Martinez Garcia Date: Wed, 24 Apr 2024 13:33:01 +0200 Subject: [PATCH 4/6] chore: refactor v-bind and $scopedSlots --- .../queries-preview/components/query-preview-list.vue | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/x-components/src/x-modules/queries-preview/components/query-preview-list.vue b/packages/x-components/src/x-modules/queries-preview/components/query-preview-list.vue index cd0fb0f9d4..7871bac89f 100644 --- a/packages/x-components/src/x-modules/queries-preview/components/query-preview-list.vue +++ b/packages/x-components/src/x-modules/queries-preview/components/query-preview-list.vue @@ -6,12 +6,12 @@ data-test="query-preview-item" > -