React-instantsearch: searchForItems (searchForFacetValues) is not working the [email protected]

Created on 19 Apr 2018  路  3Comments  路  Source: algolia/react-instantsearch

Edit 3 (found partial solution):
Ok, I've traced the code enough to find that this issue is related to algoliasearch-helper version 2.25.0 which was released yesterday. If I forcibly link against algoliasearch-helper version 2.24.0 the refinement list search box works as expected. Not sure what the underlying issue is as I don't understand the code well enough & don't have the time to trace it.

Issue

The search boxes in our RefinementList components stopped working today in our production environment. They continued to work locally until I ran npm install after which they stopped working in a local environment. We were using react-instantsearch version 4.5.1 but I have tested with 4.5.1, 4.5.2, and 5.0.3 and the issue reoccurs for me in every version.

Here is a gif showing that network requests are being made to algolia, but my component does not update,
https://gfycat.com/BigDigitalBighornsheep

The searchable attributes are configured using:

index.setSettings({
    'attributesForFaceting': [
         // ... other attributes ...
          'searchable(locations)'
        // ... other attributes ...
     ]
})

Here is a repo with a minimal example that reproduces the problem:
https://github.com/econner/react-instantsearch-facet-filters

Steps to reproduce,

  1. git clone [email protected]:econner/react-instantsearch-facet-filters.git
  2. Open src/App.js and edit the necessary parameters to point to an index.
  3. Run npm install, npm run build.
  4. Run open dist/index.html

Thanks for any help or suggestions.

Edit:
Also I tried the example from the examples repo and it seems to have not been updated for v5.0.0.
https://github.com/algolia/examples/tree/master/instant-search/react-instantsearch

Edit 2:
Ok, I ran the above example using 4.5.1 and the RefinementList search box also does not work there (which I think rules out some kind of index setting misconfiguration?).

All 3 comments

Hi @econner, thanks a lot for the detailed report of the issue. It helps a lot to understand where the it come from. Indeed you are right the problem comes from the helper I've opened an issue on the project (see https://github.com/algolia/algoliasearch-helper-js/issues/573), it will be fix asap.

About the fact that it stopped working on production, it seems that you are not using a lock file for your dependencies. It avoid this kind of issue it will always reinstall the exact same version until you explicitly update the dependency. In that case the version of the helper won't have been updated until you expliclty update react-instantsearch. You can find more details about this feature in the npm documentation (or Yarn).

The fix has been released in the version 2.25.1. Running an install on your project should fix the issue. Let us know if you still have some issues.

Hey @samouss,

Thanks for following up so quickly. I've tested my example project against 2.25.1 and it works as expected.

Also thank you for the pointer to lock files for dependencies. I did not know about those as I have little JS experience. They will definitely help us going forward.

Was this page helpful?
0 / 5 - 0 ratings