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

feat(createInstantSearch): enable _useRequestCache #1346

Merged
merged 1 commit into from
Jun 19, 2018

Conversation

samouss
Copy link
Collaborator

@samouss samouss commented Jun 18, 2018

Summary

This PR enable the option _useRequestCache on the default client. It doesn't impact clients that don't support this option. We don't apply the option on searchClient because when you provide your own implementation you want to control which option is applied to the client.

@samouss samouss requested review from vvo and Haroenv June 18, 2018 14:08
@algobot
Copy link
Contributor

algobot commented Jun 18, 2018

Deploy preview for react-instantsearch ready!

Built with commit 0f40c6b

https://deploy-preview-1346--react-instantsearch.netlify.com

@samouss samouss force-pushed the feat/request-cache branch from 01c64f1 to 18e77ac Compare June 18, 2018 14:15
@vvo
Copy link
Contributor

vvo commented Jun 18, 2018

Curious: does this solve any issue like duplicate requests right now? 🙏

Copy link
Contributor

@Haroenv Haroenv left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this isn't a breaking change since it isn't called on a search client if it's passed and accessing cache isn't really possible here. If what you showed earlier that this fixes the duplicate requests still works, then you can say this fixes #1037

@Haroenv
Copy link
Contributor

Haroenv commented Jun 18, 2018

probably some other issues too

@samouss
Copy link
Collaborator Author

samouss commented Jun 18, 2018

I didn't manage to have a working demo because CodeSandbox doesn't download the correct version of the client. But you can download the sandbox it works locally (see below). The example simulate an application with code splitting where the SearchBox is mounted after the rest of the page. By default it triggers two requests, but with the option it triggers only one.

https://codesandbox.io/s/zzqnllyqq3

Before

before

After

after

@samouss samouss force-pushed the feat/request-cache branch from 18e77ac to fdb7684 Compare June 18, 2018 17:15
@samouss samouss force-pushed the feat/request-cache branch from fdb7684 to 0f40c6b Compare June 19, 2018 07:02
@samouss samouss merged commit f772600 into master Jun 19, 2018
@samouss samouss deleted the feat/request-cache branch June 19, 2018 08:25
samouss added a commit that referenced this pull request Jun 19, 2018
<a name="5.2.0-beta.2"></a>
# [5.2.0-beta.2](v5.2.0-beta.1...v5.2.0-beta.2) (2018-06-19)

### Features

* export highlight tags from DOM / native ([#1342](#1342)) ([28a699e](28a699e))
* **createInstantSearch:** enable _useRequestCache ([#1346](#1346)) ([f772600](f772600))
* **dom:** export create class name ([#1348](#1348)) ([9017468](9017468))
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants