diff --git a/packages/react-instantsearch-core/src/core/__tests__/createInstantSearch.js b/packages/react-instantsearch-core/src/core/__tests__/createInstantSearch.js
index 3126c9e4c0..ba3ad28923 100644
--- a/packages/react-instantsearch-core/src/core/__tests__/createInstantSearch.js
+++ b/packages/react-instantsearch-core/src/core/__tests__/createInstantSearch.js
@@ -44,9 +44,12 @@ describe('createInstantSearch', () => {
_useRequestCache: true,
});
- expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(1);
+ expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(2);
expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledWith(
- `react-instantsearch ${version}`
+ `react-instantsearch (${version})`
+ );
+ expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledWith(
+ `react (${React.version})`
);
});
@@ -108,7 +111,7 @@ describe('createInstantSearch', () => {
);
expect(algoliaClientFactory).toHaveBeenCalledTimes(0);
- expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(1);
+ expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(2);
expect(wrapper.props().searchClient).toBe(algoliaClient);
});
@@ -118,7 +121,7 @@ describe('createInstantSearch', () => {
);
expect(algoliaClientFactory).toHaveBeenCalledTimes(0);
- expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(1);
+ expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(2);
expect(wrapper.props().algoliaClient).toBe(algoliaClient);
});
@@ -147,14 +150,14 @@ describe('createInstantSearch', () => {
);
- expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(1);
+ expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(2);
wrapper.setProps({
algoliaClient: newAlgoliaClient,
});
expect(wrapper.props().algoliaClient).toBe(newAlgoliaClient);
- expect(newAlgoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(1);
+ expect(newAlgoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(2);
});
it('updates the searchClient when provided searchClient is passed down', () => {
@@ -166,14 +169,14 @@ describe('createInstantSearch', () => {
);
- expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(1);
+ expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(2);
wrapper.setProps({
searchClient: newAlgoliaClient,
});
expect(wrapper.props().searchClient).toBe(newAlgoliaClient);
- expect(newAlgoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(1);
+ expect(newAlgoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(2);
});
it('does not throw when algoliaClient gets updated and does not have a `addAlgoliaAgent()` method', () => {
diff --git a/packages/react-instantsearch-core/src/core/createInstantSearch.js b/packages/react-instantsearch-core/src/core/createInstantSearch.js
index 00fcc85315..b0769c0056 100644
--- a/packages/react-instantsearch-core/src/core/createInstantSearch.js
+++ b/packages/react-instantsearch-core/src/core/createInstantSearch.js
@@ -69,7 +69,8 @@ export default function createInstantSearch(defaultAlgoliaClient, root) {
});
if (typeof this.client.addAlgoliaAgent === 'function') {
- this.client.addAlgoliaAgent(`react-instantsearch ${version}`);
+ this.client.addAlgoliaAgent(`react (${React.version})`);
+ this.client.addAlgoliaAgent(`react-instantsearch (${version})`);
}
}
@@ -88,7 +89,8 @@ export default function createInstantSearch(defaultAlgoliaClient, root) {
}
if (typeof this.client.addAlgoliaAgent === 'function') {
- this.client.addAlgoliaAgent(`react-instantsearch ${version}`);
+ this.client.addAlgoliaAgent(`react (${React.version})`);
+ this.client.addAlgoliaAgent(`react-instantsearch (${version})`);
}
}
diff --git a/packages/react-instantsearch-dom/src/core/__tests__/createInstantSearchServer.js b/packages/react-instantsearch-dom/src/core/__tests__/createInstantSearchServer.js
index 5432cbcee9..9271962f56 100644
--- a/packages/react-instantsearch-dom/src/core/__tests__/createInstantSearchServer.js
+++ b/packages/react-instantsearch-dom/src/core/__tests__/createInstantSearchServer.js
@@ -78,9 +78,12 @@ describe('createInstantSearchServer', () => {
expect(createSearchClientMock).toHaveBeenCalledTimes(1);
expect(createSearchClientMock).toHaveBeenCalledWith('appId', 'apiKey');
- expect(searchClient.addAlgoliaAgent).toHaveBeenCalledTimes(1);
+ expect(searchClient.addAlgoliaAgent).toHaveBeenCalledTimes(2);
expect(searchClient.addAlgoliaAgent).toHaveBeenCalledWith(
- `react-instantsearch ${version}`
+ `react (${React.version})`
+ );
+ expect(searchClient.addAlgoliaAgent).toHaveBeenCalledWith(
+ `react-instantsearch (${version})`
);
});
@@ -114,7 +117,13 @@ describe('createInstantSearchServer', () => {
const wrapper = shallow();
- expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(1);
+ expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(2);
+ expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledWith(
+ `react (${React.version})`
+ );
+ expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledWith(
+ `react-instantsearch (${version})`
+ );
expect(wrapper.props().algoliaClient).toBe(algoliaClient);
});
diff --git a/packages/react-instantsearch-dom/src/core/createInstantSearchServer.js b/packages/react-instantsearch-dom/src/core/createInstantSearchServer.js
index 9d2fd20300..47fb81a573 100644
--- a/packages/react-instantsearch-dom/src/core/createInstantSearchServer.js
+++ b/packages/react-instantsearch-dom/src/core/createInstantSearchServer.js
@@ -165,7 +165,8 @@ const createInstantSearchServer = algoliasearch => {
algoliasearch(this.props.appId, this.props.apiKey);
if (typeof client.addAlgoliaAgent === 'function') {
- client.addAlgoliaAgent(`react-instantsearch ${version}`);
+ client.addAlgoliaAgent(`react (${React.version})`);
+ client.addAlgoliaAgent(`react-instantsearch (${version})`);
}
indexName = this.props.indexName;