Skip to content
This repository has been archived by the owner on Dec 30, 2022. It is now read-only.

Commit

Permalink
feat(createInstantSearch): enable _useRequestCache (#1346)
Browse files Browse the repository at this point in the history
  • Loading branch information
samouss authored Jun 19, 2018
1 parent 807d68b commit f772600
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@ describe('createInstantSearch', () => {
shallow(<CustomInstantSearch appId="app" apiKey="key" indexName="name" />);

expect(algoliaClientFactory).toHaveBeenCalledTimes(1);
expect(algoliaClientFactory).toHaveBeenCalledWith('app', 'key');
expect(algoliaClientFactory).toHaveBeenCalledWith('app', 'key', {
_useRequestCache: true,
});

expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledTimes(1);
expect(algoliaClient.addAlgoliaAgent).toHaveBeenCalledWith(
`react-instantsearch ${version}`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,9 @@ export default function createInstantSearch(defaultAlgoliaClient, root) {
this.client =
this.props.searchClient ||
this.props.algoliaClient ||
defaultAlgoliaClient(this.props.appId, this.props.apiKey);
defaultAlgoliaClient(this.props.appId, this.props.apiKey, {
_useRequestCache: true,
});

if (typeof this.client.addAlgoliaAgent === 'function') {
this.client.addAlgoliaAgent(`react-instantsearch ${version}`);
Expand Down

0 comments on commit f772600

Please sign in to comment.