From 8635d486aefcc8406edf63dc10449f8fce7d876f Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Tue, 3 Dec 2024 17:58:23 +0100 Subject: [PATCH 1/4] feat: make vue compatible with composition --- .../src/components/InstantSearch.js | 13 ++++++++++++- .../src/util/createInstantSearchComponent.js | 5 +++++ 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/packages/vue-instantsearch/src/components/InstantSearch.js b/packages/vue-instantsearch/src/components/InstantSearch.js index 8c733558c0..1ade52bcc1 100644 --- a/packages/vue-instantsearch/src/components/InstantSearch.js +++ b/packages/vue-instantsearch/src/components/InstantSearch.js @@ -22,7 +22,11 @@ export default createInstantSearchComponent({ }, indexName: { type: String, - required: true, + required: false, + }, + compositionID: { + type: String, + required: false, }, routing: { default: undefined, @@ -101,6 +105,7 @@ export default createInstantSearchComponent({ insightsClient: this.insightsClient, insights: this.insights, indexName: this.indexName, + compositionID: this.compositionID, routing: this.routing, stalledSearchDelay: this.stalledSearchDelay, searchFunction: this.searchFunction, @@ -111,6 +116,12 @@ export default createInstantSearchComponent({ }; }, render: renderCompat(function (h) { + if (!this.indexName && !this.compositionID) { + console.error( + 'Missing either "index-name" or "compositionID" property on "ais-instant-search"' + ); + } + return h( 'div', { diff --git a/packages/vue-instantsearch/src/util/createInstantSearchComponent.js b/packages/vue-instantsearch/src/util/createInstantSearchComponent.js index c172ceb326..5709f1e1dc 100644 --- a/packages/vue-instantsearch/src/util/createInstantSearchComponent.js +++ b/packages/vue-instantsearch/src/util/createInstantSearchComponent.js @@ -28,6 +28,11 @@ export const createInstantSearchComponent = (component) => indexName(indexName) { this.instantSearchInstance.helper.setIndex(indexName || '').search(); }, + compositionID(compositionID) { + this.instantSearchInstance.helper + .setIndex(compositionID || '') + .search(); + }, stalledSearchDelay(stalledSearchDelay) { // private InstantSearch.js API: this.instantSearchInstance._stalledSearchDelay = stalledSearchDelay; From 15cbcd0e56da486f3fe7eaedabdb17e4fe838692 Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Tue, 3 Dec 2024 18:06:32 +0100 Subject: [PATCH 2/4] =?UTF-8?q?chore:=20increase=20vue2=20package=20size?= =?UTF-8?q?=20=F0=9F=A4=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- bundlesize.config.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bundlesize.config.json b/bundlesize.config.json index 862ad8b91d..52a70b56a6 100644 --- a/bundlesize.config.json +++ b/bundlesize.config.json @@ -34,7 +34,7 @@ }, { "path": "packages/vue-instantsearch/vue2/cjs/index.js", - "maxSize": "20.25 kB" + "maxSize": "20.50 kB" }, { "path": "packages/vue-instantsearch/vue3/cjs/index.js", From 62d704b075d603135530999f413d790151a4508c Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Tue, 3 Dec 2024 18:10:38 +0100 Subject: [PATCH 3/4] chore(lint): allow console.error --- packages/vue-instantsearch/src/components/InstantSearch.js | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/vue-instantsearch/src/components/InstantSearch.js b/packages/vue-instantsearch/src/components/InstantSearch.js index 1ade52bcc1..61da310e3a 100644 --- a/packages/vue-instantsearch/src/components/InstantSearch.js +++ b/packages/vue-instantsearch/src/components/InstantSearch.js @@ -117,6 +117,7 @@ export default createInstantSearchComponent({ }, render: renderCompat(function (h) { if (!this.indexName && !this.compositionID) { + // eslint-disable-next-line no-console console.error( 'Missing either "index-name" or "compositionID" property on "ais-instant-search"' ); From de3b6ea5bd5794f13decfcb5a7984f0fca3d72d5 Mon Sep 17 00:00:00 2001 From: Emmanuel Date: Wed, 4 Dec 2024 10:36:15 +0100 Subject: [PATCH 4/4] feedback: do not add warning --- packages/vue-instantsearch/src/components/InstantSearch.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/vue-instantsearch/src/components/InstantSearch.js b/packages/vue-instantsearch/src/components/InstantSearch.js index 61da310e3a..ad7ec32afa 100644 --- a/packages/vue-instantsearch/src/components/InstantSearch.js +++ b/packages/vue-instantsearch/src/components/InstantSearch.js @@ -116,13 +116,6 @@ export default createInstantSearchComponent({ }; }, render: renderCompat(function (h) { - if (!this.indexName && !this.compositionID) { - // eslint-disable-next-line no-console - console.error( - 'Missing either "index-name" or "compositionID" property on "ais-instant-search"' - ); - } - return h( 'div', {