Numerical facet works as a refinement list but not a range


I’m seeing behaviour with react-instantsearch where a filter for some reason no longer works with the <RangeInput /> component. To get it working again I’ve had to change it to a refinement list. The error in the console says

Uncaught Error: year is not present in `facets` or `disjunctiveFacets`

However, year is listed as a facet in the dashboard, and as I said, when I use a refinement list with the same attribute it all works fine. Any idea what the problem could be?

Hi @kris,

Could you provide a small working example of the error? Will be much easier to investigate the issue.
We have a jsFiddle template if you want, you can also provide a repo as you want.

Thanks! :slight_smile:

Sorry about the late reply, holidays and all :christmas_tree::slight_smile: I’ve been trying to reproduce the error on Codesandbox but it doesn’t happen there, so this is getting somewhat difficult for me to debug :sweat_smile: At least it doesn’t seem to be an issue with the index itself. The exact same code throws the following errors in my app:

Uncaught Error: year is not present in `facets` or `disjunctiveFacets`
    at SearchResults.../../node_modules/algoliasearch-helper/src/SearchResults/index.js.SearchResults.getFacetStats (index.js:677)
    at Connector.getProvidedProps (connectRange.js:195)


The above error occurred in the <AlgoliaRange(Range)> component:
    in AlgoliaRange(Range) (at SearchFilterYear.js:26)

Any ideas what could cause this since nothing breaks when using a <RefinementList /> component?

Bump, any ideas how to debug this @samuel.vaillant? I’m at a loss here.

Hi @kris,

Sorry for the late response I didn’t see your message.

It seems that it’s an issue with the connectRange connector. The issue is already track on GitHub, you take a look at the example. Could you tell me if the value that you pass to the attributeName prop is something dynamic like in the GitHub example?

Thanks for your help!

That fix in 4.4.1 actually seems to have solved the issue! That’s great! Thanks @samuel.vaillant :+1: